Difference between Union and Typedef
Title
Question
What is the difference declaring the structure of union and typedef?
Advance-C Union-and-Typedef 04-05 min 0-10 sec
Answers:
Union is a data type that allows you to store different data types in the same memory location, i.e., the program can use any one data type at a time.
Typedef can be used to give a new name for the extisting types.
For example, consider the definition given below in your program
typedef int INTEGER;
Now, you can use
INTEGER a1, a2;
which will be the same as
int a1,a2;
Union is a data type that allows you to store different data types in the same memory locations i,e, the program can use any one data type at a time
Typedef can be used to give a nea name for the existing types.
For example , consider the definition given below in your program
Typedef int INTEGER;
Now ,you can use
INTEGER a1,a2;
which will be the same as
int a1,a2
Login to add comment