Hello Everyone, I want to know the main difference between Structure and Union. In my last C interview, I was stuck in this question. I know about structure basically it is a user-defined data-type that’s used to store a combination of data that can potentially belong to different data-types. Can anyone know about the union? Also, Can anyone know the below syntax is correct as a structure point?
Defining a Structure
Through struct, we can define the structure of a single student as follows:
struct Student {
string name;
int class;
string phone;
string email;
}