|
|
1.1 root 1: /*
2: * Demonstrarte a union bug.
3: */
4: #include <stdio.h>
5:
6: typedef union {
7: char p_char;
8: short p_short;
9: int p_int;
10: long p_long;
11: } p_val;
12:
13: main()
14: {
15: p_val test_val;
16:
17: test_val.p_long = 0x11223344;
18:
19: printf("char 0x%x\n", test_val.p_char);
20: printf("short 0x%x\n", test_val.p_short);
21: printf("int 0x%x\n", test_val.p_int);
22: printf("long 0x%x\n", test_val.p_long);
23:
24: } /* main() */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.