What is the similarity between a structure, union, and enumeration?

By Anjnee Bhatnagar|Updated : June 27th, 2022

What is the similarity between a structure, union, and enumeration?

  1. All of them let you define new values.
  2. All of them let you define new data types.
  3. All of them let you define new pointers.
  4. All of them let you define new structures.

Answer: Option B. All of them let you define new data types.

The similarity between a structure, union, and enumeration is that all of them let you define new data types.

Solution

The answer to the question: What is the similarity between a structure, union, and enumeration? All three are used to define the user-defined data types. All the three, i.e., structure, union, and enumeration, can take heterogeneous data as input. The structure uses the keyword struct, union uses the keyword union, and enumeration uses the keyword enum. Options A, C, and D are incorrect regarding structure, union, and enumeration data types.

☛ Related Questions:

Comments

write a comment

Follow us for latest updates