About C Interview Questions-Enum and Unions :

This C Interview Questions-Enum and Unions providing all the interview questions on enum and unions in C language. Enum is a set of elements in C language and Union is a user-defined data type in C language.


C Language Interview Questions-Enum and Unions

What is enum in C?
Used to work with mathematical sets by identifying all the elements of the set using constant integer values in C program.


How to work with a set of elements in C program?
Using enum user-defined data type.


Do we need to assign values to set elements?
By default, these elements initialize starting with 0.
We can also assign values explicitly.


What are the default values of enum values?
Constant integers starting with 0.


Advantage of enum set in C programming?
Set of strings(names) and its functionality can be applied easily using integer values.


Pre-defined examples of enum sets?
colors
fonts
drivers in Graphics programming.


Define Union data type?
A user-defined data type used to store more than one element of different data types.


Difference between Union and Structure?
Structure elements get independent memory locations.
Union elements share the common memory.


What is the advantage of Union data type?
Used to conserve the memory in C programming.


Can we process more than one element of Union variable at a time?
No, we can process element by element.


What is the size of union variable?
Size of union variable equals to the size of element occupies higher memory of the union.


> C Langauge Interview Questions – Pre processor <

Share this