CS105

What is a function?       Why do you need a function?

Scope of the function.   Examples of functions.     



Why do you need a function?



Likewise, the main function in a C++ program controls the highest level of logical steps which solve a problem. The main function does not contain too much of the detailed work - all the details are relegated to other separate functions which the main function calls upon when they are needed.

When a C++ function is called, the statements in the called function are executed. When the function is finished, control returns to the place from which it was called, and the program continues.


Next >>

 

       What is a function?       Why do you need a function?

Scope of the function.   Examples of functions.