void如何带回指针
请我详细讲解下面的题目,急用!!!!!第一题
void foo(int[][3]);
main()
{ int a[3][3]={{1,2,3},{4,5,6},{7,8,9}};
foo(a);
printf("%d",a[2][1]);
}
void foo(int b[][3])
{
++b;
b[1][1]=9;
}
the output for this program is:
第二题
void test(int a)
{ a=9;
}
main()
{ int a=0;
test(a);
printf("a=%d\n",a);
}
the output for this program is:
第三题:
int *f(void)
{
int x=10;
return(&x);
}
int *f2(void)
{
int*ptr;
*ptr=10;
return ptr;
}
int*f(void)
{ int*ptr;
ptr=(int*)malloc(sizeof(int));
return ptr;
}
which of the above three functions are likely to cause problem with pointers:
(a)only f3 (B)only f1and f3 (C) only f1and f2(D)f1 f2 f3