Firstly, Hi to the board!
Can anyone tell me what is wrong with this code? I have read that "A function can be defined anywhere in the module".
Although when I define the same function before the main function, it works when I call it.
When I try to compile and execute I get the message...Code:#include <cstdio> #include <cstdlib> #include <iostream> using namespace std; int main(int nNumberofArgs, char* pszArgs[]) { void hello() { cout << "hello" << endl; } hello(); system("PAUSE"); return 0; }
Line 9: expected primary-expression before "void".
This works fine...
Any help would be greatly appreciated. Thanks!Code:#include <cstdio> #include <cstdlib> #include <iostream> using namespace std; void hello(void) { cout << "hello" << endl; } int main(int nNumberofArgs, char* pszArgs[]) { hello(); system("PAUSE"); return 0; }



LinkBack URL
About LinkBacks



