C语言习题集合(指针)
{
chars[80],*t1,*t2;intm;gets(s);m=strlen(s);t1=s;
t2=【1】;while(t1<t2)
{if(*t1!=*t2)break;else{t1++;
【2】;}}
if(t1<t2)printf("NO\n");elseprintf("YES\n");
}
13.当运行以下程序时,从键盘输入:apple↙
tample↙
则下面程序的运行结果是________。#include"stdio.h"main(){
chars[80],*t;t=s;gets(t);
while(*(++t)!='\0')
if(*t=='a')break;else{t++;gets(t);}puts(t);}
14.当运行以下程序时,从键盘输入6↙,则下面程序的运行结果是________。
#include"stdio.h"#include"string.h"
main(){
chars[]="97531",c;c=getchar();f(s,c);puts(s);}
f(char*t,charch){
while(*(t++)!='\0');while(*(t-1)<ch)*(t--)=*(t-1);