相关题目
下面程序的运行结果是( )。
# include
main ( )
{ static char a[]="language ",b[]="progratne" ;
char *p1,*p2 ; int k ;
p1= a ; p2= b ;
for ( k = 0 ; k <-7 ; k + + )
if ( *(p1+k)==*(p2+k)) printf ("%c",*(p1+k)) ;
}
下面程序的运行结果是( )。
# include
main ( )
{ int a = 28 , b ;
char s [10],*p ;
p =s ;
do { b = a % 16 ;
if ( b < 10 ) *p=b + 48 ;
else *p = b + 55 ;
p++;
a = a / 5 ;
} while ( a > 0 ) ;
*p =‘\ 0 ' ;
puts ( s ) ;
}
下面程序的运行结果是( )。
# include
void delch ( char *s )
{Int i , j ;
char *a ;
a =s;
for ( i = 0 , j = 0 ; a [ i ] ! = ' \ 0 ';i++ ;)
if ( a [i ]>= '0'&&a[i]<='9') { s[j]=a[i];j++ ; }
s[j]='\0';
}
main ( )
{char * item = "a34bc" ;
delch ( item ) ;
printf ( "\n%s" , item) ; }
下面程序的运行结果是( )。
# include
# include
main ( )
{char *s1 =“AbDeG " ;
char *s2 = " AbdEg " ;
s1+=2 ; s2 +=2 ;
printf ( “%d\n” , strcmp ( s1 , s2 ) ) ;
}
下面程序的运行结果是( )。
#include
#include
fun(char *s)
{char a[7];
s=a;
strcpy(a,"look") ;
}
main ( )
{char *p;
fun(p);
puts(p);
}
下面程序的运行结果是( )。
#include
#include
fun(char *w,int n)
(char t,*s1,*s2;
s1=w;s2=w+n-1;
while(s1
main ()
{char *p;
p="1234567”;
fun(p,strlen(p));
puts(p);
}
下面程序的运行结果是( )。
#include
main()
{char *p,s[]="ABCDEFG";
for(p=s;*p!='\0';)
{printf("%s\n",p);
p++;
if(*p!='\0') p++;
else break ;
}
}
下面程序的运行结果是( )。
#include
#include
main ( )
{char *p1,*p2,str[50]="abc";
p1="abc"; p2="abc";
strcpy(str+1,strcat(p1,p2));
printf("%s\n",str);}
下面程序的运行结果是( )。
#include
main ( )
{char str[ ]="cdalb";
abc(str);
puts(str);
}
abc(char *p)
{int i,j;
for(i=j=0;*(p+i)!='\\0';i++)
if(*(p+i)>='d') {*(p+j)=*(p+i);j++;}
*(p+j)='\\0';
}
下面程序的运行结果是( )。
#include
fun(char *p)
{int i,t; char ts[81];
for(i=0,t=0;p[i]='\\0';i+=2 )
if( ! isspace(*p+i)&&(*(p+i)!='a'))
ts[t++]=toupper(p[i];
ts[t]='\\0';
strcpy(p,ts);
}
main ( )
{char str[81]={"a_b_c_d_ef_g"); //( _表示空格)
fun(str);
puts(str);
}
