If you don't provide a declaration for a function, C makes a guess at it. This guess is almost always wrong, hence your "erroneous values". C++ doesn't do this.
Up vote 0 down vote favorite share g+ share fb share tw.
I have tested this fact on Turbo C++ 3.0, VC++ 2008 express and Borland C++ 6. If I add a C program with *. C extension to the project, I am able to compile and run the program without including header files.
But in this case, some functions (like sqrt(), etc..) are returning erroneous values. If I add a C program with *. CPP extension to the project, I am not able to compile and run the program without including header files.
Why? C header-files link|improve this question asked May 12 '11 at 6:44Saqib3,092339101 87% accept rate.
Possible duplicate of Not including stdlib. H does not produce any compiler error! – Paul R May 12 '11 at 8:00.
In C, when the compiler does not find the definition of a function, it assumes it's an external function returning an integer. So the code compiles, an if the linker then finds the function it will run as well. But with unexpected results.
By default in C function return type is int, and even if prototype not declared you'll be able to use, for example, libc functions. Of course, if its return value not int, you've got erroneous values. C++ are more stricter and disallow this.
Also, gcc implements some functions as built-ins. You can try compiling with -fno-builtin options, if you use it.
The C++ standard requires a function prototype to be seen before a function is used. C does not have this requirement. If a C compiler sees an undeclared function it creates an implicit declaration assuming that the function returns int.
If the function doesn't really return int unpredictable things will happen, as you are seeing with sqrt.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.