struct student_simple
{
int rollno;
char *name;
};
之间的区别
struct student_simple *s2 = malloc(sizeof(struct student_simple *));
struct student_simple *s3 = malloc(sizeof(struct student_simple ));
我可以毫无问题地使用 s2 和 s3 但是当我在 gdb 中检查大小时
gdb$ p sizeof(struct student_simple) gives 16
gdb$ p sizeof(struct student_simple *) gives 8