What is the C equivalent of this C# code?
[StructLayout(LayoutKind.Explicit)]
struct Test
{
[FieldOffset(0)] int a; // Integer at byte offset 0
[FieldOffset(1)] int b; // Integer at byte offset 1
[FieldOffset(3)] int c; // Integer at byte offset 3
};
(I don’t care if it’s non-portable, e.g. int is assumed to be 4 bytes, etc.)
This seems to work fine under Visual Studio: