This code gives me no re-declaration error.
#include<stdio.h>
int i;
int i = 27;
int main()
{
printf("%d",i);
return 0;
}
According to me I declared and defined an uninitialised global variable with 0 as default value. And later re-declared, redefined and assigned it 27 value. I was expecting it to give a re-declaration error because both i's are in same scope(global). But I'm not getting any error why?
But below code gives me a re-declaration error as expected because of defining them in same scope.
#include<stdio.h>
int main()
{
int i;
int i = 27;
printf("%d",i);
return 0;
}