1.

Which is the correct syntax for extern function declaration?(a) extern function_name(argument_list);(b) extern return_type function_name(argument_list);(c) extern (return_type)function_name(argument_list);(d) return_type extern function_name(argument_list);This question was posed to me in unit test.My question is based upon Extern Variable topic in chapter Memory Allocation & Scope of Variable of Object Oriented Programming

Answer»

The correct choice is (b) extern return_type function_name(argument_list);

Easiest explanation - The syntax must CONTAIN the keyword extern first, to DENOTE that the function is extern. Though the function are extern by default but among the given choices, it should contain the keyword, for explicit DECLARATION. Then the usual function declaration FOLLOWS.



Discussion

No Comment Found

Related InterviewSolutions