本帖最后由 董月峰 于 2014-4-13 13:35 编辑
// 楼主,把char *name;放最前面就是48了
#include <stdio.h> int main() { struct rankRecord { char *name; int number;
int score; }; struct rankRecord records[3] = { {"jack", 1, 5000}, {"jim", 2, 500}, {"jake", 3, 300} }; records[2].score = 3000; printf("%d\n", records[2].score); printf("%lu\n", sizeof(records)); printf("%lu\n", sizeof(records[0].name)); printf("%lu\n", sizeof(records[1].number)); printf("%lu\n", sizeof(records[2].score)); return 0; }
输出结果: 3000 48 8 4 4
Program ended with exit code: 0
|