问几个比较弱的有关问题 !
问几个比较弱的问题 !!呵呵
主函数中有int *p[n],int (*p)[n];把这两个的实参传递出去。
写出外调函数fun的形参的类型
------解决方案--------------------
主函数中有int *p[n],int (*p)[n];把这两个的实参传递出去。
写出外调函数fun的形参的类型
------解决方案--------------------
- C/C++ code
#include <stdio.h> void foo(int *p1[], int (*p2)[3]) { printf("%d\n", *p1[0]); printf("%d\n", *p1[1]); printf("%d\n", *p1[2]); printf("===\n"); printf("%d\n", (*p2)[0]); printf("%d\n", (*p2)[1]); printf("%d\n", (*p2)[2]); } int main(void) { int a = 1, b = 2, c = 3; int v[] = { a, b, c }; int *p1[] = { &a, &b, &c }; int (*p2)[3] = &v; foo(p1, p2); return 0; } 1 2 3 === 1 2 3 Press any key to continue