How about "wots FAQ"? As in,Quote:
Originally Posted by Hugo716
FAQ > Explanations of... > Definition of EOF and how to use it effectively
Printable View
How about "wots FAQ"? As in,Quote:
Originally Posted by Hugo716
FAQ > Explanations of... > Definition of EOF and how to use it effectively
hehe, thanks :)
EOF means end of file
putting a semi-colon after the main function is just asking for trouble.
Look at this...
in general. NEVER place a semicolon after function title implementation.Code:#include <iostream>
using std::cout;
using std::endl;
// function prototypes
void func ( void );
void funct2 ( void ); // it is ok to end function prototypes with a semi=colon
int main ( void ); // this is an error
{
func(); // function calls end with a semi-colon
return 0;
cin.get();
}
void func ( void ); // this is an error
{
func2();
}
void func2 ( void ); // so is this
{
}
ONLY include a semi-colon after a function prototype and when you call a function
Hope this helps -pete
You'll need to understand the difference between a function DECLARATION and a function DEFINITION. A declaration simply asserts that a function exists and is ready for use.
So you can use main() although you haven't defined it's contents (although calling main() is a VERY BAD IDEA™). But to really compile your code, you'll need to define what main() does. This is the definition, which does not include the semicolon to differentiate it from a declaration:Code:int main(int, char**);
Code:int main(int n, char **v)
{
std::cout << "Hello World!\n";
std::cin.get();
}