Tag: 指向数组的指针

使用和解除引用(void **)

我想传递一个指向函数的“多态”数组。 我可以在没有警告的情况下做以下事情: foo (void* ptr); bar() { int* x; … foo(x); } gcc显然会自动将x转换为(void*) ,这只是花花公子。 但是,当我执行以下操作时,我会收到警告: foo (void** ptr); bar() { int** x; // an array of pointers to int arrays … foo(x); } note: expected ‘void **’ but argument is of type ‘int **’ warning: passing argument 1 of ‘foo’ from incompatible pointer type [enabled […]