{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

summary07 - to understand – should be used with caution...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
int factorial( int n) { int product = 1; while (n > 0) { product = n * product; n--; } return product; } Summary Ch 3.5 – 3.6 Chapter 3.5 Local Variables Can have a variable total in a function and total in your main and it will be two variables Variables can be local to a function and have the function as their scope Can also be local to main and have the main part of the program as their scope const double PI = 3.14159 ; - global named constant should place #include directives, constants, and function declarations separately global variables are like constants except can be changed, however they make a program harder
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: to understand – should be used with caution • formal parameters are variables local to the function • do NOT define a variable that is already defined in the function declaration • can use namespaces globally and locally Chapter 3.6 Overloading Function Names • Overloading a function- giving two or more of the same names to a variable • When two functions share a name, the compiler checks the number of arguments • C++ automatically typecasts in a non-overloaded function – be careful when overloading functions....
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online