Hey, i just wanted to know the difference between #include<iostream> and #include<iostream.h> Also the difference between int main() and void main().
Difference between ..............
Post a Reply
|Oldest Newest Rating|
· May 29, 2015
There is no difference between #include<iostream> and #include<iostream.h> b/c the .h extension is applied even without explicitly writing it. The same is true for all universal C++ libraries. However your own header files must have the .h extension explicitly mentioned like "Globals.h" and must be in quotes instead of in <>.
int main() means the main function will return an integer usually an error code. Return 0 is usually implied b/c that means no errors have occurred while any other number means something happened that was not expected.
void main() means that the main function doesn't return any error codes and that is not allowed in C++. It will instead produce a compilation error since the main function must return an error code no matter what.
The main function can be overloaded, but the main function must always return an int as part of the definition for C++. Think of it as being predefined.
· May 30, 2015
Not everything. What I said about header files not belonging to the standard collection is correct.
When I did include things like <iostream.h>, it actually did work. However, it does not seem to work universally so what I said about standard libraries is wrong.
Still, maybe somebody else could better explain standard universal C++ headers like <iostream>,<stdlib> and so on.
Used in many types of software including music players, video games, and many large scale applications.
|Bucky Roberts Administrator|