33,317
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
void a(char *p)
{ p="world";
return 0;}
int main(void)
{
char *p="hello";
a(p);
printf("%s",p); //不能写成*p 为什么
}
#include <stdio.h>
void a(char *p) //若要改变p的指向,可以改成char * &p;
{
p="world";
return 0;
}
int main(void)
{
char *p="hello";
a(p);
printf("%s",p); //不能写成*p 为什么 可以写成*p 但要改成printf("%c",*p); 输出h;
}