昨天在写图书管理系统的时候遇到了这样一个问题
结构体定义如下
struct Date{
int year;
int month;
int day;
}
struct book{
long number;
char book_name[30];
char author_name[30];
double price;
Date date;
}
book *temp=new book[100];
当使用sizeof时,代码结果如下
cout<< sizeof(temp);//结果为8
cout<<sizeof(temp[0]);//结果为88