(1)#includevoid test_f(int **testv) { printf("%dn",(int)testv[0]);//打印结果13,但是有警告因为强转 printf("%dn",(int)(*testv));//打印结果13,但是有警告因为强转这2种一样的 printf("%pn",testv[0]);//打印a[0]的地址 } int main() { int test_v[1]={13};//先赋初值 test_f((void*)test_v); } 实际上就是传了test_v[0]的地址到test_f函数,但是test_f函数的指针是2级指针,而传的是一级指针。这样弄实际上有问题指针不匹配,但是不影响传递变量,但是变量不能赋值,一赋值就出错。作用的话和const类似吧。 (2) #include void test_f(int (*test_v)[]) { //这样是可以赋值的 **test_v=14; printf("%dn",(*testv)[0]);//打印结果14 (*test_v)[0]=15; printf("%dn",*(*testv+0));//打印结果15 } int main() { int test_v[1]={13};//先赋初值 test_f(&test_v); }



