我收到了有关此代码的警告。
Warning {
` del2_.c: In function ‘addIntoCell’:`
`del2_.c:401:3: warning: passing argument 1 of ‘resizeArray’ from incompatible pointer type [enabled by default]`
`del2_.c:378:6: note: expected ‘struct t_grapheVertex ***’ but argument is of type ‘struct t_grapheVertex **`
}
这就是我定义函数的方式:
void resizeArray(t_grapheVertex ***ele)
这是我调用该函数时的警告:
resizeArray(&(*cell)->elements);
这是细胞的结构:
typedef struct st_cell
{
int nbElements;
struct st_cell* next;
t_grapheVertex* elements;
} t_cell;
void resizeArray(t_grapheVertex ***ele){
t_grapheVertex *temp;
int newSize;
newSize = arraySize*increaseRate ;
temp = realloc(*ele , sizeof(int)*newSize);
if(**ele == NULL)
{
printf("fail to resize\n");
return;
}
else
{
printf("resized succesfully\n");
**ele=temp;
arraySize = newSize ;
}
}
最佳答案
(*cell)->elements 给你一个指针,然后&符号给你一个double指针。同时,您期望 resizeArray() 函数有一个三重指针 - 您真的是这个意思吗?
如果可以的话,可以分享一下resizeArray的代码吗?
关于c - 三重指针警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19015267/