difference between structure and union.


Ø  difference between structure and union.

STRUCTURE
void main()
{
struct student
{
char name[10];
int rollno;
float avg;
}s1;
printf(“no. of bytes for s1=%d”,sizeof(s1));
 getch();
}
UNION
void main()
{
 union student
{
char name[10];
int rollno;
float avg;
}s1;
printf(“no. of bytes for s1=%d”,sizeof(s1));
 getch();
}

No comments:

Post a Comment