69,371
社区成员
发帖
与我相关
我的任务
分享
void test(char ***pt);
int main(void)
{
char *arr[] = {"123555555555555", "12222222222222222"};
char **p = arr;
*p = NULL;
test(&p);
printf("main: p =%s\n",*p);
return 0;
}
void test(char ***pt)
{
char arr[] = "hello world\n"; //这样才不行
**pt = arr;
printf("test: p =%s\n",**pt);
}
void test(char ***pt);
int main(void)
{
char *arr[] = {"123555555555555", "12222222222222222"};
char **p = arr;
*p = NULL;
test(&p);
printf("main: p =%s addr of *p: %p\n",*p, (unsigned int)*p); //
return 0;
}
void test(char ***pt)
{
**pt = "hello world\n";
printf("test: p =%s and addr of **pt: %p\n",**pt, (unsigned int)**pt); //打印地址值
}
void test(char **pt);
int main(void)
{
char *arr[] = {"123555555555555", "12222222222222222"};
char **p = arr;
*p = NULL;
test(p); //就像int a = 10; test(a);想在test修改a的值,然后反映到main函数里一样的错误
if (NULL == *p)
{
printf("main: p =%s\n",*p);
}
else
{
printf("*p is NULL\n");
}
}
void test(char **pt)
{
*pt = "hello world\n";
printf("test: p =%s\n",*pt);
}