CODE 1
#include <stdio.h>
int i;
int i=10;
int main(void)
{
return 0;
}
CODE 2
#include <stdio.h>
int i=0;
int i=10;
int main(void)
{
return 0;
}
Why Code 1 is not giving any compilation error but code 2 does ?
I think in code 1 when first time i is declared ,at compile time it will be allocated memory and initialize to zero(implicitly) and in code 2 i just explicitly declare and define int i to be zero.
but i don't know how code 2 give error of redefinition.