- 論壇徽章:
- 0
|
#include <stdio.h>
struct test {
int data;
int name;
};
struct bwt {
struct test atest;
int first;
int second;
int third;
};
int main()
{
struct bwt test1[4];
test1[0].atest.data = 50;
test1[0].atest.name = 70;
test1[0].first = 10001;
test1[0].second = 200;
test1[0].third = 300;
printf("test1.atest.data:\t%d\ntest1.first:\t%d\ntest1.second:\t%d\ntest1.third:\t%d\n", test1[0], test1[0].first, test1[0].second, test1[0].third);
return 0;
}
===========程序結(jié)果===================
deron@deron-desktop:/home/work$ ./test
test1.atest.data: 50
test1.first: 70
test1.second: 10001
test1.third: 200
希望各位大蝦能否解釋下上面這個問題。在獲取test1.atest.data的值得時候直接用test1[0],這樣導(dǎo)致后面test1[0].first,test1[0].second, test1[0].third都不能獲得正確的。 |
|