- A function name has global scope
- The scope of a formal parameter is identical to the scope of a local variable declared in the function
- The scope of a global variable or constant extends from its declaration to the end of the file
- The scope of a local variable or constant extends from its declaration to the end of the block in which it is declared
const float PI = 3.14f; // global
float areaOfCircle(float r); // global
void main(void)
{
float area; // local
area = areaOfCircle(4.5);
. . .
}
// formal parameters are local to the
// function
float areaOfCircle(float radius)
{
float area; // local
area = PI * radius * radius;
return area;
}