Explaining sections

Preprocessor Directives: I guess the preprocessor directives can include some data into our code. Like the replacement of some placeholders or integrating a library, but I really dont know.

Main Function: is initiating our functions below the main function

Expression Statements: command to put out something to the terminal

Declaration statement: defines variables and calculations

Return statement: when the value is zero, the return statement is correct, and the function gets compiled or works?
I don’t really understand, why something must be returned, and why it has to be zero. Maybe the function needs to return no errors, so that the return value is 0, but I guess thers something else to it…

Greetings :wave:

In the preprocessor directive we have included the iostream file , so that we can use the cout and cin and it also executed first . In the main function everything we have written is going to be executed . In the main function we declared some integer variables and set it to const , then in the expression statements we are trying to print the output in the terminal using cout . As main is a function it must have a return type in our case it is int , but till now we have nothing to return from the main function so we have setted return 0 , in one word you can say now the return type of main function is void .

Privacy & Terms