summaryrefslogtreecommitdiff
path: root/3/9_data_structures/45_rec.c
diff options
context:
space:
mode:
Diffstat (limited to '3/9_data_structures/45_rec.c')
-rw-r--r--3/9_data_structures/45_rec.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/3/9_data_structures/45_rec.c b/3/9_data_structures/45_rec.c
new file mode 100644
index 0000000..f04ac0e
--- /dev/null
+++ b/3/9_data_structures/45_rec.c
@@ -0,0 +1,42 @@
+struct {
+ char *a;
+ short b;
+ double c;
+ char d;
+ float e;
+ char f;
+ long g;
+ int h;
+} rec;
+// A.
+// |char* 8|short 2|gap 6|double 8|char 1|float 4|char 1|gap 2|long 8|int 4|gap 4|
+// |-------|-------------|--------|---------------------------|------|-----------|
+// 8 8 8 8 8 8
+//
+// a 0
+// b 8
+// c 16
+// d 24
+// e 25
+// f 29
+// g 32
+// h 40
+//
+// B.
+// 48
+//
+// C.
+// |char* 8|short 2|char 1|float 4|char 1|double 8|long 8|int 4|gap 4|
+// |-------|-----------------------------|--------|------|-----------|
+// 8 8 8 8 8
+//
+// a 0
+// b 8
+// c 16
+// d 10
+// e 11
+// f 15
+// g 24
+// h 32
+//
+// total 40