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?
Main()
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.
QUIZ
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.