指针后面有中括号表示什么main(){char st[20],*ps;int i;printf("input a string:\n");ps=st;scanf("%s",ps);for(i=0;ps[i]!='\0';i++)if(ps[i]=='k'){printf("there is a 'k' in the string\n");break;}if(ps[i]=='\0') printf("There is no 'k' in the st

来源:学生作业帮助网 编辑:作业帮 时间:2024/07/12 03:04:11
指针后面有中括号表示什么main(){char st[20],*ps;int i;printf(
xn@_eTڦBn 'fձ)B@i(vFA94MJP$/ߢ6<߮jV#:i2_#:܆{rB|c##om"BI^1 aŴ[ɤaH4^0Rb <')$Rٵ2X+u\z7 igdDK;iiko2M(ՙqpt~m:oVI„AfLCC Q.eyLsd%10QV-nޯ:]yStҢ>尡8teC&ɕ8ӷԼYT*F-j ^]ֹ{4JtF+Œ,ܒ1p't:;7>Yx2\-8d{܃FߙQ+C?bH/Ɉ}w5AkxecoVCKϩybFIm

指针后面有中括号表示什么main(){char st[20],*ps;int i;printf("input a string:\n");ps=st;scanf("%s",ps);for(i=0;ps[i]!='\0';i++)if(ps[i]=='k'){printf("there is a 'k' in the string\n");break;}if(ps[i]=='\0') printf("There is no 'k' in the st
指针后面有中括号表示什么
main(){
char st[20],*ps;
int i;
printf("input a string:\n");
ps=st;
scanf("%s",ps);
for(i=0;ps[i]!='\0';i++)
if(ps[i]=='k'){
printf("there is a 'k' in the string\n");
break;
}
if(ps[i]=='\0') printf("There is no 'k' in the string\n");
}
for循环中的第二个式子 为什么是for(i=0;ps[i]!='\0';i++) ps是指针变量啊?

指针后面有中括号表示什么main(){char st[20],*ps;int i;printf("input a string:\n");ps=st;scanf("%s",ps);for(i=0;ps[i]!='\0';i++)if(ps[i]=='k'){printf("there is a 'k' in the string\n");break;}if(ps[i]=='\0') printf("There is no 'k' in the st
ps[i] 里的中括号,C语言处理成运算符,ps[i] 等价于 *(ps+i),
C语言里,指针和数组关系密切.*ps, 一旦有指向地址后,就可以看成 一维数组ps[], 哪种形式便于阅读理解,就可以用哪种形式. ps[i] 等价于 *(ps+i).