defining "extern" is like giving a promise to the compiler that let me use it here as this variable is defined somewhere else and when you will use it you will get the memory reference.
So using extern is only declaring that this variable is available somewhere.
In this question we declared the variable $i$ but it was not intialized anywhere it does not have any memory allocated to it.
So in the next line when the program executes $i=1024$ then it will get no memory reference to $i$ and will throw undefined reference $'i'$