Which statement about using a struct name in C++ is correct?

Options

  • A. A struct name can be used directly as a type name without typedef
  • B. A struct must always be preceded by the keyword struct when declaring an object
  • C. A struct cannot be used as a user-defined type
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

A. A struct name can be used directly as a type name without typedef

Detailed Explanation

Answer: (A) A struct name can be used directly as a type name without typedef

In C++, after declaring a structure, its name can directly be used as a type name.

For example:

struct Student {
int roll;
};

An object can then be declared simply as:

Student s;

Unlike C, C++ does not require writing struct Student s; every time an object is declared.