语言课件之指针.ppt

第十章 10.1地址和指针的概念 10.2 变量的指针和指向变量的指 针变量 void print(char *name[ ],int n) {int i;  for(i=0;i<n;i++)    printf(″%s\n″,name[i]); } 运行结果为: BASIC Computer design FORTRAN Follow me Great Wall *p2=*p1; *p2=′\0′; printf(″string a is:%s\n″,a); printf(″string b is:″); for(i=0;b[i]!=′\0′;i++) printf(″%c″,b[i]); printf(″\n″); } 程序必须保证使p1和p2同步移动 10.4.2 字符指针作函数参数 例10.19 用函数调用实现字符串的复制 #include stdio.h void main() { void copy_string(char from[ ], char to[ ]); char a[ ]=″I am a teacher.″; char b[ ]=″you are a student.″; printf(“string a=%s\n string b=%s\n″, a

文档评论(0)

1亿VIP精品文档

相关文档