Home › C Tutorial › C scope
C scope
Where names are visible.
Local variables exist only inside their block. Globals are visible everywhere but make code harder to follow.
Example code
#include <stdio.h>
int g = 100;
int main() {
int x = 5;
{ int x = 9; printf("%d ", x); }
printf("%d %d\n", x, g);
return 0;
}