I have a question regarding the following:
For the int32_t datatype, does it not have to start at address that is a multiple of 4? So for example it can only start at address such as the following: 0x1004, 0x1008, 0x1012, 0x1016,....
So why is it that b can stores the number 0xEF0369BE when EF starts at 0x1007? I understand we need to add 2 bytes of padding after a[2]. But even if we add 2 bytes of padding, b will still start at 0x1007, so wouldn't that makes b not satisfy the requirement of alignment?
I understand that char a[2] can starts anywhere since char has alignment requirement of 1. But int32_t has alignment requirement of 4, so it can only starts at address that is divisible by 4.
I thought I understand about alignment, but somehow I don't think I am now. Could someone explains a bit what is going on here in terms of alignment? and the alignment of the different types inside a Struct.
