+ 3
Please explain this:
#include <iostream> using namespace std; int main() { cout<<main; getchar(); return 0; }
3 Answers
+ 3
I believe 1 is the compilers default false value.
ref: http://www.cplusplus.com/forum/beginner/147175/
+ 6
Sure,
When you start a C++ code, int main is false by default ( any value that is not 0 - the 1 ).
Why, because the compiler need to know if the code finishes or not.
getchar() - takes a character like 'a' for input ( C like function inputs do not work well in the C++ playground)
return 0; - main becomes true the compiler knows that the code is done
0
Manual and why it's output is 1?