Saturday 20 April 2013

Scope Qualifier

Scope Qualifier
#include <stdio.h>
int i = 0;
int main()
{
for (int i = 0; i < 10; i++)
printf("%5d%5d\n", i, ::i);
return 0;
}
The program produces the following output:
0 0
1 0
2 0
.
.
9 0
i refers to the local variable, ::i refers to the global variable.

No comments:

Post a Comment