/******************************************************************************
Online C Compiler.
Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <stdio.h>
#include <stdlib.h> // for EXIT_SUCCESS
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h> // for offsetof()
typedef struct
{
uint8_t a;
uint16_t b;
bool c;
uint32_t d;
float e;
double f;
} MyStruct;
int main()
{
MyStruct test;
printf ("sizeof(test) = %ld\n", sizeof(test));
printf ("a is %lu bytes at offset %lu\n", sizeof(test.a), offsetof(MyStruct, a));
printf ("b is %lu bytes at offset %lu\n", sizeof(test.b), offsetof(MyStruct, b));
printf ("c is %lu bytes at offset %lu\n", sizeof(test.c), offsetof(MyStruct, c));
printf ("d is %lu bytes at offset %lu\n", sizeof(test.d), offsetof(MyStruct, d));
printf ("e is %lu bytes at offset %lu\n", sizeof(test.e), offsetof(MyStruct, e));
printf ("f is %lu bytes at offset %lu\n", sizeof(test.f), offsetof(MyStruct, f));
return EXIT_SUCCESS;
}