1 #include <stdio.h>
2
3 int
main(void)4 main(void) {
5 struct foo {
6 int x;
7 char *p;
8 } bar, baz, baz2;
9 char buf[128];
10 char *p;
11 bar.x = 123;
12 bar.p = "hi";
13 printf("%d: %s!!\n", bar.x, bar.p);
14 baz = bar;
15 printf("%d: %s!!\n", baz.x, baz.p);
16
17 p = buf;
18 while ((unsigned long)p % sizeof(struct foo)) {
19 ++p;
20 }
21 *(struct foo *)p = bar;
22 baz2 = *(struct foo *)p;
23 printf("%d: %s!!\n", baz2.x, baz2.p);
24
25
26
27 #if 0
28 } bar = {
29 123, "hello"
30 }, baz = {
31 NULL, 0
32 };
33 #endif
34
35 }
36
37