二维指针,传地址
1 #include <stdio.h> 2 #include <stdlib.h> 3 4 /* 5 值传递,地址传递,引用传递 6 */ 7 void find1(char array[], char search, char **pa) 8 { 9 //等价于, array = str, search = p, pa = &pc; 10 11 **pa = 'c'; 12 13 } 14 15 int main( ) 16 { 17 char str[1000], p[1000]; 18 while( scanf("%s%s",&str,&p) != EOF) 19 { 20 char st= 'e'; 21 char *pc = &st; 22 char *pt = "e"; //赋值字符串,而不是字符 23 // pc = "abc"; 不能赋值常量 24 find1(str,p[0],&pc); 25 printf("%c\n",*pc); 26 } 27 return 0; 28 }
posted on 2012-12-29 00:37 more think, more gains 阅读(179) 评论(0) 编辑 收藏 举报