下面显示的代码有什么问题。
char filter[2] = {'\0'};
*filter = (char *)calloc((unsigned int)buf.st_size + 1, sizeof(unsigned char));
根据我的理解,更改阵列位置没有问题吗?为什么我问这是因为一个警告,
Warning 1 warning C4047: '=' : 'char' differs in levels of indirection from 'char *'
有什么想法吗?
知道了,将代码更改为。谢谢@ouah
char *filter = {'\0'};
filter = (char *)calloc((unsigned int)buf.st_size + 1, sizeof(unsigned char));
答案 0 :(得分:10)
*filter
是char
,您要为其指定char *
值。