I want to check the size of the variable arr. My question is why i am getting the size of arr 56 instead of 50. Because, as far as i know, union allocates the memory of the highest data type declares in union. Here in the union student char name[50] has the highest size.
#include <stdio.h>
#include <string.h>
union student
{
int roll;
double marks;
char name[50];
};
int main()
{
union student arr;
printf("%d",sizeof(arr));
return 0;
}