int A = 7; // global variable declaration
int B = 8; // global variable declaration
int C = 9; // global variable declaration
void F1(void); // function declaration
void F2(void); // function declaration
void main(void)
{
// local variables in main
// they "hide" the global variables a, b, c
int A, B, C;
A = 10; // has no effect on global A
. . .
}
void F1(void)
{
// local variables in F1
int x, y, z;
x = A; // now, x has same value as A (7)
y = B; // now, y has same value as B (8)
z = C; // now, z has same value as C (9)
}
void F2(void)
{
// local variables in F2
// NOT the same as the ones in F1 above
int x = 1, y = 2, z = 3;
A = x; // now, A has same value as x (1)
B = y; // now, B has same value as y (2)
C = z; // now, C has same value as z (3)
}