Need Help : Explanation on Code Output

Правка en4, от codeforrest, 2018-06-26 19:30:45
I was doing this question based on output.The code is depicted below. 
#include
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!

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en5 Английский codeforrest 2018-06-26 19:32:09 20
en4 Английский codeforrest 2018-06-26 19:30:45 36
en3 Английский codeforrest 2018-06-26 18:58:07 158
en2 Английский codeforrest 2018-06-26 18:20:06 144
en1 Английский codeforrest 2018-06-26 18:18:15 450 Initial revision (published)