新手问问题....
1、#include"stdio.h"
main()
{ int i;
struct student
{
char name[10];
int num;
int age;
char sex[2];
int grade;
char specialty[16];
}stud;
printf("%d",sizeof(stud));
}
输出结果:44个字节;int 类型在vc占四个字节,应该输出40才对。
2、
#include"stdio.h"
main()
{ int i;
struct student
{
char name[10];
short num;
short age;
char sex[2];
short grade;
char specialty[16];
}stud;
printf("%d",sizeof(stud));
}
输出结果:34个字节;short 类型在vc占2个字节,输出34,没意见。