Possible Duplicate:
Redefinition allowed in C but not in C++?
#include<stdio.h>
int i;
int i;
int main()
{
// int i;
// int i;
printf("%d\n",i);
return 0;
}
~
The above code runs wihtout giving any error gcc -Wall -Werror demo.c -o demo
But when I uncomment the local
i
variables the comment out the global
i
,It gives me errors .
In function ‘main’:
demo.c:7:6: error: redeclaration of ‘i’ with no linkage
demo.c:6:6: note: previous declaration of ‘i’ was here
What is this local global concept here ?, Anybody Please explain.