I surprised when compiled following program on GCC compiler. It's successfully worked. Compiler gives only warning.
warning: 'i' initialized and declared 'extern' [enabled by default] extern int i = 10; ^
My code:
#include <stdio.h>
 //Compiler version gcc 4.9
extern int i = 10;
 int main()
 {
    printf("%d\n",i);
    return 0;
 }
Output:
10
Why doesn't give compiler error? Is it undefined behavior?
 
    