
please wait
|
|
doesntWork.cpp:9: error: ISO C++ forbids initialization of member 'x' doesntWork.cpp:9: error: making 'x' static doesntWork.cpp:9: error: ISO C++ forbids in-class initialization of non-const static member 'x' |
Change "return 0;" to "return 1". Return 0 won't return a value. |
return 0;
returns 0, return 1;
returns 1. See, they both return a value.Danny Toledo wrote: |
---|
You are not allowed to initialize x in the class definition. |
|
|
|
|
Change "return 0;" to "return 1". Return 0 won't return a value. |
return 0
is the correct way to end your main() program function. It's the same as saying return EXIT_SUCCESS
which is the proper, portable way for your program to communicate exit status to the OS. return 1
indicates your program failed in some way and the OS should inform the user.