I was doing this question based on output.The code is depicted below. ↵
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~↵
`#include<stdio.h>↵
struct s↵
{↵
unsigned a:5;↵
unsigned b:5;↵
unsigned c:5;↵
unsigned d:5;↵
}v={1, 2};↵
↵
main()↵
{↵
printf("size of v = %d",sizeof(v));↵
return 0;↵
}↵
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`↵
↵
The output of above code is "size of v = 4". I will be glad if someone could help how we are getting this 4 as output?Thanks in advance!
struct s↵
{↵
unsigned a:5;↵
unsigned b:5;↵
unsigned c:5;↵
unsigned d:5;↵
}v={1, 2};↵
↵
main()↵
{↵
printf("size of v = %d",sizeof(v));↵
return 0;↵
}↵
↵
The output of above code is "size of v = 4". I will be glad if someone could help how we are getting this 4 as output?Thanks in advance!