1.

Which of the following syntax for declaring a variable of struct STRUCT can be used in both C and C++?(a) struct STRUCT S;(b) STRUCT S;(c) Both struct STRUCT S; and STRUCT S;(d) Both C and C++ have different syntaxI had been asked this question during an interview.This interesting question is from C++ Concepts topic in section Basics Concepts of C++ of C++

Answer»

The correct choice is (a) struct STRUCT S;

To explain: C PROGRAM REQUIRES struct keyword while DEFINING a variable of any structure, therefore, we cannot use the second STRUCT S; definition to DECLARE a variable.



Discussion

No Comment Found

Related InterviewSolutions