1.

If extern variable is initialized with the declaration then _______________________(a) Also the header file with definition is required(b) The header file with definition must be included(c) There is no need to include any other header file for definition(d) The extern variable produces compile time errorThis question was addressed to me during an interview.This question is from Extern Variable in portion Memory Allocation & Scope of Variable of Object Oriented Programming

Answer»

Correct CHOICE is (c) There is no need to include any other HEADER FILE for definition

Explanation: When the value for the extern VARIABLE is defined with its declaration, then there is no need to include any file for the definition of the variable. The Initialization ACTS as a definition for the extern variable in the file itself.



Discussion

No Comment Found

Related InterviewSolutions