1

我对C很陌生(多年后)。我正在使用 lcc64 并有以下声明

char *logMessage = strdup(argv[1]);

我不知道为什么我会收到错误

"operands of = have illegal types 'pointer to char' and 'int"

有什么建议么?

4

1 回答 1

4

您需要将<string.h>strdup() 声明为返回 char*,否则编译器认为它返回一个 int

于 2014-12-03T22:36:39.167 回答