summaryrefslogtreecommitdiff
path: root/3/9_data_structures/45_rec.c
diff options
context:
space:
mode:
authorMike Vink <mike@pionative.com>2024-06-14 09:23:32 +0200
committerMike Vink <mike@pionative.com>2024-06-14 09:23:32 +0200
commit8092f4c334db547ced59d6f439b558dad35e1ab2 (patch)
treefa462fa885efea1ec6095d015286998d632c2c3d /3/9_data_structures/45_rec.c
parentb424517a33bf61aedff29eed74a665402ab496ba (diff)
commit for once
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