What is a function?
A function is a reusable sequence of statements designed to do a particular job.
What function is run first of all in a C++ program?
What are return values?
Return values are inside the called function that is a return statement to indicate the specific value being returned to the caller. This is the actual value returned from function.
Are nested functions allowed in C++?
Nested functions are not supported in C++, because there cannot be a function within a function without declaring a function an extension of the GNU compiler.
1a. Output is “6”
1b. This code will not compile since it’s a nested function
1c. This compiled but the returned values are not used by main and discarded.
1d. A and B on different lines
1e. This did not compile because Function printA() returns void, which main tries to send to std::cout. This will produce a compile error.
1f. Returned “5” on two separate lines, ignored “7”
1g. This has an invalid name so it will not compile
1h. Compiled “1” but could be anything depending on the compiler because the function is missing parenthesis.