fork download
  1. #include<stdio.h>
  2. struct {
  3. short x[5];
  4. union {
  5. float y;
  6. long z;
  7. } u;
  8. }t;
  9.  
  10. int main() {
  11. printf("short=%d\n",sizeof(short));
  12. printf("float=%d\n",sizeof(float));
  13. printf("long=%d\n",sizeof(long));
  14. printf("size of union=%d\n",sizeof(t.u));
  15. printf("size of structure=%d",sizeof(t));
  16. }
  17.  
Success #stdin #stdout 0s 5460KB
stdin
Standard input is empty
stdout
short=2
float=4
long=8
size of union=8
size of structure=24