【C++】struct

1、申请内存

在C++中,结构体不仅可以使用malloc关键字申请内存,也可以使用new关键字申请内存。

struct_a *a = (struct_a *)malloc(sizeof(struct_a));

struct_a *a = new struct_a();
posted @ 2024-07-16 18:27  NotReferenced  阅读(1)  评论(0编辑  收藏  举报