extern int i;
void add();
int main()
{
add();
if (i == 0)
printf("scope rules\n");
}
void add()
{
int i;
}
I getting error in this case even variable i is defined in add function
but it will give no build errors in following case
extern int i;
void add();
int main()
{
int i;
//add();
if (i == 0)
printf("scope rules\n");
}
void add(){
//int i;
}