i have this struct that is in theory 14 bytes
typedef struct ActionArgument{
ManagedObjectId managed_object;
uint32_t scope1;
OIDType action_type;
uint16_t length; } ActionArgument;
the struct ManagedObjectId is 6 bytes , scope is "suposedly" 4 bytes , OIDType is a uint16_t ( 2 bytes ) so is length. But the problem is when i print the size of scope i get 4 bytes which is right , but the size of struct ActionArgument becomes 16. I tried to correct this by spliting scope to 2 uint16_t variables (scope1 and scope2) and it worked . But i am still intrigued why the size of a uint23_t is 4 but when i put it in a struct it becomes 6? can some one explain to me ?
I am using kalilinux 4.14.0-kali3-amd64
thanks.