Is it true that a global variable may have several declarations, but only one definition?
Deep from Kolkata, India is saying Yes is correct answer
indhuja indhuja from Erode, India is saying No is correct answer
Sidharth kashyap from Patna, India is saying Yes is correct answer
R.K YouTube channel from Bhubaneswar, India is saying Yes is correct answer
Rajeswari Raji from Hyderabad, India is saying Yes is correct answer
In the following program where is the variable a getting defined and where it is getting declared?
extern int a;
- [A] extern int a is declaration, int a = 20 is the definition
- [B] int a = 20 is declaration, extern int a is the definition
- [C] int a = 20 is definition, a is not defined
- [D] a is declared, a is not defined
- [A] Both are identical
- [B] No difference, except extern int fun(); is probably in another file
- [C] int fun(); is overrided with extern int fun();
- [D] None of these