1.

Which condition is true if the extern variable is used in a file?(a) All the header files declare it(b) Only few required files declare it(c) All header files declared it if required(d) Only one header file should declare itThis question was addressed to me in semester exam.My doubt is from Extern Variable topic in division Memory Allocation & Scope of Variable of Object Oriented Programming

Answer»

The CORRECT choice is (d) Only one header file should declare it

To EXPLAIN: Only one header file should declare the EXTERN variable to be USED. There must not be more than one file declaring the same extern variable. This is to ENSURE that there is no ambiguity in using the extern variable.



Discussion

No Comment Found

Related InterviewSolutions