【发布时间】:2015-07-13 12:40:15
【问题描述】:
我正在尝试使用 MACROS 分配一些内存。但我得到这个错误:
错误:')' 标记之前的预期表达式
错误:')' 标记之前的预期语句
这是我的代码:
#define ALLOC(p,n) (p*)malloc(sizeof(p)*n)
int main(){
char *ponteiro;
ponteiro=ALLOC(5,ponteiro);
return 0;
}
【问题讨论】:
-
计算宏定义中的括号..
-
请see why not to cast
malloc()和C中的family返回值。
标签: c compiler-errors macros c-preprocessor