Govind
The One Musketeer
- Joined
- Apr 22, 2005
- Sythe Gold
- 23
- Messages
- 7,825
Proof that structs are just abstractions of contiguous memory:
f = 7.
Code:
#include <stdlib.h>
#include <stdio.h>
typedef struct __s1
{
int a;
int b;
} s1;
int main()
{
long f = 0;
s1 st;
st.a = 7;
st.b = 4;
memcpy(&f, &st, 4);
printf("%d\n", f);
return 0;
}
f = 7.



