There are two types of definition for global variables.
1>Weak Symbol
2>Strong Symbol
At each definition it adds the symbol and its value in symbol table.
int var ; //Weak Symbol
int var = 20; //strong symbol
For weak later u can change the value in the symbol table by initializing it But after u initialized it becomes strong symbol.so u it can not change again the the value u will define it for next time.
Check these cases.
CASE 1:
int var;
int var;
int var;
/* Here it will not give any error as each time it defines it replaces in the symbol table.so it takes the last value which u given but here last also u not initialized.So it will be part of BSS. */
CASE 2:
int var;
int var;
int var = 20;
/* No error as 1st two is weak symbol(As not initialized) then in the third line when u initilized it replaces the value for the symbol var as 20 and it becomes strong symbol. */
CASE 3:
int var;
int var;
int var = 20; /* became strong*/
int var = 30; /* Again u want to change the value in strong symbol */
/* Here till two line it is weak symbol But in third line u initialized so it became strong symbol and replaced the value.In 4th line again u want to change But u can not change the value in 4th line as it will not replaces for strong symbol. */
Here it will not give any error as the next u just declared a variable.
CASE 4:
int var;
int var;
int var = 20; /* became strong*/
int var; /* As u just declared it so it is no problem (But compiler dependent also (if they check strict common symbol it will give error)). */