1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
typedef struct {
UINT8 a;
UINT8 d;
UINT16 b;
UINT16 c;
UINT8 e;
} myStructA;
myStructA valA;
printf("sizeof(myStructA) = %li\r\n", sizeof(myStructA));
printf("@valA.a = 0\r\n");
printf("@valA.d = %li\r\n", (UINT32)&valA.d - (UINT32)&valA.a);
printf("@valA.b = %li\r\n", (UINT32)&valA.b - (UINT32)&valA.a);
printf("@valA.c = %li\r\n", (UINT32)&valA.c - (UINT32)&valA.a);
printf("@valA.e = %li\r\n", (UINT32)&valA.e - (UINT32)&valA.a);
typedef struct {
UINT8 a;
UINT8 d;
UINT16 b;
UINT16 c;
UINT16 e;
} myStructB;
myStructB valB;
printf("sizeof(myStructB) = %li\r\n", sizeof(myStructB));
printf("@valB.a = 0\r\n");
printf("@valB.d = %li\r\n", (UINT32)&valB.d - (UINT32)&valB.a);
printf("@valB.b = %li\r\n", (UINT32)&valB.b - (UINT32)&valB.a);
printf("@valB.c = %li\r\n", (UINT32)&valB.c - (UINT32)&valB.a);
printf("@valB.e = %li\r\n", (UINT32)&valB.e - (UINT32)&valB.a);
typedef struct {
UINT8 a;
UINT8 d;
UINT16 b;
UINT32 c;
UINT16 e;
} myStructC;
myStructC valC;
printf("sizeof(myStructC) = %li\r\n", sizeof(myStructC));
printf("@valC.a = 0\r\n");
printf("@valC.d = %li\r\n", (UINT32)&valC.d - (UINT32)&valC.a);
printf("@valC.b = %li\r\n", (UINT32)&valC.b - (UINT32)&valC.a);
printf("@valC.c = %li\r\n", (UINT32)&valC.c - (UINT32)&valC.a);
printf("@valC.e = %li\r\n", (UINT32)&valC.e - (UINT32)&valC.a);
typedef struct {
UINT8 a;
UINT8 b;
UINT8 c;
} myStructD;
myStructD valD;
printf("sizeof(myStructD) = %li\r\n", sizeof(myStructD));
printf("@valD.a = 0\r\n");
printf("@valD.b = %li\r\n", (UINT32)&valD.b - (UINT32)&valD.a);
printf("@valD.c = %li\r\n", (UINT32)&valD.c - (UINT32)&valD.a); |
Partager