fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdint.h>
  4.  
  5. int main(void)
  6. {
  7. typedef struct
  8. {
  9. uint8_t tolerance;
  10. char footprint[24];
  11. char value[24];
  12. char comment[100];
  13. char type[24];
  14. uint16_t amountOfElements __attribute__((packed));
  15.  
  16. } FEEDER_PART_PARAMETER;
  17.  
  18.  
  19. FEEDER_PART_PARAMETER FeederPartParameter[34]; // FeederPartParameter[0] is unused.
  20.  
  21.  
  22. printf("sizeof tolerance = %u\r\n", sizeof(FeederPartParameter[2].tolerance));
  23. printf("sizeof footprint = %u\r\n", sizeof(FeederPartParameter[2].footprint));
  24. printf("sizeof value = %u\r\n", sizeof(FeederPartParameter[2].value));
  25. printf("sizeof comment = %u\r\n", sizeof(FeederPartParameter[2].comment));
  26. printf("sizeof type = %u\r\n", sizeof(FeederPartParameter[2].type));
  27. printf("sizeof amountOfElements = %u\r\n", sizeof(FeederPartParameter[2].amountOfElements));
  28. printf("sizeof whole struct = %u\r\n", sizeof(FeederPartParameter[2]));
  29.  
  30.  
  31. return 0;
  32. }
Success #stdin #stdout 0s 2292KB
stdin
Standard input is empty
stdout
sizeof tolerance = 1
sizeof footprint = 24
sizeof value = 24
sizeof comment = 100
sizeof type = 24
sizeof amountOfElements = 2
sizeof whole struct = 175