STRUCTURE OF PROGRAM (part 5)

Posted on at


STRUCTURE OF PROGRAM (part 5)

return 0;

The return statement cause the main functions to finish. return may be followed by a return codes(in our example is followed by the return code 0). A return code of 0 for the main functions are generally interpreted as the programs worked as expected without any errors during its execution.

 

This is the most usual way to end a C++ console programs. You may have noticed that not all the lines of this programs perform actions when the code is executed. There were lines containing only comment (those beginning by //). There were lines with directive for the compiler's preprocessor (those beginning by #). Then there were lines that began the declaration of the functions (in this cases, the main function) and, finally line with statements (like the insertion into cout), which were all includes within the blocks delimited by the braces ({}) of the main function. The programs have been structured in different lines in order to be more readable, but in C++, we does not has strict rule on how to separate instructions in different lines. For examples, instead of int main () { cout << " I am ready for first programe to learn from tutorial man.i feel it easy and i will enjoy all program!"; return 0; }



About the author

160