通过学习函数的接口加深了对指针的理解。 #include <stdio.h>#include <stdlib.h>#include <string.h>void ChangePa1(char **pb){char *b= (char *) malloc(sizeof(char)*10);if(b==NULL){printf("Out of Memory/n");exit(1);}strcpy(b,"hello!!!world");*pb=b;}void ChangePa2(char * pb){char *b= (char *) malloc(sizeof(char)*10);if(b==NULL){printf("Out of Memory/n");exit(1);}strcpy(b,"hello!!!world");pb=b;}char *ChangePa3(){char *b= (char *) malloc(sizeof(char)*10);if(b==NULL){printf("Out of Memory/n");exit(1);}strcpy(b,"hello!!!world");return b;}int main(){char a[]="hello,world";char *pa=a;ChangePa2(pa);printf("%s/n",pa);ChangePa1(&pa);printf("%s/n",pa);printf("%s/n",ChangePa3());return 0;}#include <stdio.h>#includ 你的当前访问异常,请进行认证后继续阅读剩余内容。 提交