【发布时间】:2014-05-09 08:35:36
【问题描述】:
我需要将我的 C++ 代码翻译成 C99:
struct TransferData {
int data[256];
} *readData;
readData = (TransferData *) malloc(sizeof(struct TransferData));
我几乎尝试了所有方法,但每次都会出现编译器错误。 有人可以帮忙吗?
【问题讨论】:
-
你也应该发布一些编译器错误。
-
Note that casting the result of
mallocis considered bad style inC(虽然在C++中是必需的,尽管您可能不应该首先使用malloc)。