下面显示的代码有什么问题。
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));
最佳答案
*filter
是一个 char
,您正在为其分配一个 char *
值。
关于c - 警告 C4047 : '=' : 'char' differs in levels of indirection from 'char *' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15730984/