sizeof一个对象,返回的不一定是该对象实例占用的内存字节大小。
struct不是class,class有构造函数,new一个class的实例会自动调用其构造函数。
vector <int>是对象,只能用来new,不能用来malloc
struct test{}; struct test *t = (struct test*)malloc(sizeof(test));
64,678
社区成员
250,490
社区内容
加载中
试试用AI创作助手写篇文章吧