Mercurial > hg > Members > nobuyasu > bitfield
annotate bit.c @ 0:70f82040dbc7 default tip
bit.c sizeOfWord.c
author | nobuyasu |
---|---|
date | Tue, 15 Feb 2011 11:25:07 +0900 |
parents | |
children |
rev | line source |
---|---|
0 | 1 #include <stdio.h> |
2 | |
3 struct | |
4 { | |
5 char ans0; | |
6 char ans1: 1; | |
7 char ans2: 2; | |
8 char ans3; | |
9 char ans4: 3; | |
10 }test; | |
11 | |
12 int main() | |
13 { | |
14 test.ans0 = 0; | |
15 test.ans1 = 0; | |
16 test.ans2 = 2; | |
17 test.ans3 = 1; | |
18 test.ans4 = 3; | |
19 int i; | |
20 char *ptr = &test; | |
21 for(i=0; i<3; i++){ | |
22 printf("%x\n",ptr+i); | |
23 } | |
24 printf("%x\n",&test.ans0); | |
25 // printf("%x\n",&test.ans1); | |
26 | |
27 return 0; | |
28 } |