Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Jun 14th, 2018 52 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. #include <stdio.h>
  2. #include <stdint.h>
  3. #include <assert.h>
  4.  
  5. struct FF{
  6.     unsigned a:2;
  7.     unsigned b:5;
  8.     unsigned c:4;
  9.     unsigned d:5;
  10. };
  11.  
  12. union UU{
  13.     struct FF f;
  14.     uint16_t  t;
  15. } u;
  16.  
  17. int main()
  18. {
  19.     u.f.a = 1;
  20.     u.f.b = 30;
  21.     u.f.c = 13;
  22.     u.f.d = 25;
  23.     assert(u.t == 52985);
  24.     assert(sizeof(u) == 4);
  25.     printf("value:%d size:%d\n", u.t, (int)sizeof(u));
  26.     return 0;
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top