"Hello World" does not return 0 in Xcode

Quite new to c++ and programming, so I apologize in advance for the simplicity of my question. When I run the default "Hello World" code in XCode:
1
2
3
4
5
6
#include <iostream>

int main() {
    std::cout << "Hello, World!\n";
    return 0;
}


why does 0 not appear in my output space? The "Hello, World!" text appears, but the "0" is omitted. This is not the case when I run the program in CodeBlocks. Does anyone know why that is?
Welcome to C++ and the forum!

int main() is basically a function and after the function is done executing, the compiler returns 0, which represents normal exit of the program.
Abnormal termination of the program is represented by a 1 or other non-zero number.

0 is just a return type for int main() and does not appear in your output.
It is not a part of your output stream.

I don't know why CodeBlocks displays 0, maybe it's just an IDE dependent thing.

Side note:
0 in C++ stands for false.
Computer understand only two things: True and False. 0 is False and 1 (and all other digits) are True.
Last edited on
Thank you! That makes a lot of sense.
Topic archived. No new replies allowed.