malloc和(object *)malloc有什么区别?

时间:2017-04-06 15:46:06

标签: c

我试图了解演员阵容及其运作方式。我有这个

(在头文件中定义)

typedef struct {
    int code;
    char* name;
    float concentration;
    int quantity;
} Farmacy;

在.c文件中我何时应该使用:

创建新对象
Farmacy* f= malloc(sizeof(Farmacy));

Farmacy* f= (Farmacy*)malloc(sizeof(Farmacy));

0 个答案:

没有答案