|
From: Ioannis V. <no...@ho...> - 2002-11-06 00:49:46
|
The code is not portable. It doesn't compile in C++ mode: temp.cpp: In function `int main()': temp.cpp:4: `strcmp' undeclared (first use this function) temp.cpp:4: (Each undeclared identifier is reported only once for each function it appears in.) temp.cpp:4: warning: unused variable `int i' > Execution finished. Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com <http://www.noicys.freeurl.com/> * Alternative URL: http://run.to/noicys -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Santiago Sent: Tuesday, November 05, 2002 7:48 PM To: dev-cpp-users-list Subject: [Dev-C++] Why does this work??? Hi all, In the two books I have, it says that in order to use the C-Style function strcmp, I need to #include <string.h>. I tried the following in compilers including DevC++ and it works.......? //no includes..... int main() { char a[] = "Hello"; int i = strcmp(a, "There"); return 0; } To better show you, I didn't use any #include. Anyone has any idea as to why this program compiles? If iostream.h is added and if you cout<<i then it shows the returned value. Thanks for your feedback. San |