fork download
  1. // Online C compiler to run C program online
  2. #include <stdio.h>
  3. #include<stdint.h>
  4.  
  5. struct {
  6. uint8_t a; // 1 byte
  7. uint32_t b; // 4 bytes
  8.  
  9. uint8_t c; // 1 byte
  10. // Only 2 bytes of padding needed now!
  11. } ss;
  12. // This fits in 8 bytes total.
  13. int main() {
  14. // Write C code here
  15.  
  16. printf("size of struct %d", sizeof(ss));
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
size of struct 12