C语言
第921题
有如下程序:
#include <stdio.h>
#include <string.h>
main()
{
char a[]="THIS", *b="OK";
printf("%d,%d,%d,%d\n", strlen(a), sizeof(a), strlen(b), sizeof(b));
}程序运行后的输出结果是()。
第922题
有如下程序:
#include <stdio.h>
#include <string.h>
main()
{
char name[10]="c-book";
char *str=name;
printf("%d,%d,%d,%d\n", sizeof(name), strlen(name), sizeof(str),
strlen(str));
}程序运行后的输出结果是()。
第923题
有以下程序:
#include <stdio.h>
#include <string.h>
main()
{
char name[9]="c##line";
char *str=name;
printf("%d,%d,%d,%d\n", sizeof(name), strlen(name), sizeof(str),
strlen(str));
}程序运行后的输出结果是()。
第924题
有以下程序
#include <stdio.h>
main()
{
char *p1 = 0;
int *p2 = 0;
float *p3 = 0;
printf("%d,%d,%d\n", sizeof(p1), sizeof(p2), sizeof(p3));
}程序运行后的输出结果是()。
第925题
有以下程序(strcpy为字符串复制函数,strcat为字符串连接函数):
#include <stdio.h>
#include <string.h>
main()
{
char a[10] = "abc",b[10] = "012",c[10] = "xyz";
strcpy(a+1,b+2);
puts(strcat(a,c+1));
}程序运行后的输出结果是()。
第926题
有以下程序:
#include <stdio.h>
#include <string.h>
main()
{
char a[20]="ab",b[20]="cdef";
int k=0;
strcat(a,b);
while(a[k]!='\0')
{
b[k]=a[k];
k++;
}
puts(b);
}程序的运行结果是()。
第927题
有以下程序(其中的strstr()函数头部格式为:char *strstr(char*p1,char *p2)确定p2字符串是否在p1中出现,并返回p2第一次出现的字符串首地址):
#include <stdio.h>
#include <string.h>
char *a="you";
char *b="Welcome you to Beijing!";
main()
{
char *p;
p=strstr(b,a)+strlen(a)+1;
printf("%s\n",p);
}程序的运行结果是()。
第928题
有以下程序:
#include <stdio.h>
#include <string.h>
char *a="you";
char *b="Welcome you to Beijing!";
main()
{
char *p;
p=b;
while(*p != *a)p++;
p+=strlen(a)+1;
printf("%s\n",p);
}程序运行后的输出结果是()。
第929题
有以下程序:
#include <stdio.h>
#include <string.h>
main()
{
char s[]="Beijing";
printf("%d\n",strlen(strcpy(s,"China")));
}程序运行后的输出结果是()。
第930题
有以下程序:
#include<stdio.h>
#include<string.h>
main()
{
char w[20],a[5][10]={"abcdef","ghijkl","mnopq","rstuv","wxyz."};
int i;
for(i=0;i<5;i++)w[i]=a[i][strlen(a[i])-1];
w[5]='\0';
puts(w);
}程序的运行结果是()。
第931题
有以下函数:
int fun(char *x,char *y)
{
int n=0;
while((*x==*y)&&*x!='\0')
{
x++;
y++:
n++;
}
}函数的功能是()。
第932题
有以下函数:
int fun(char *ps)
{
char *p;
p=ps;
if(*ps==NULL)return 0;
while(*++p);
return(p-ps);
}该函数的功能是()。
第933题
有以下函数
int aaa(char *s)
{
char *t=s;
while(*t++);
t--;
return (t-s);
}以下关于aaa函数功能叙述正确的是()。
第934题
有以下函数
int fun(char *s)
{
char *t=s;
while(*t++);
return(t-s);
}该函数的功能是()。
第935题
有以下函数:
void fun(char*p,char*q)
{
while((*p++=*q++)!='\0');
}该函数的功能是()。
第936题
下列函数的功能是()。
fun(char * a,char * b)
{
while((*b= *a)!='\0')
{
a++;
b++;
}
}
第937题
有以下函数:
int fun(char *s,char *t)
{
while((*s)&&(*t)&&(*t++==*s++));
return (*s-*t);
}函数的功能是()。
第938题
有以下程序:
#include <stdio.h>
#include <string.h>
main()
{
int i;
char a[]="How are you!";
for(i=0;a[i];i++)
{
if(a[i]==' ')
{
strcpy(a,&a[i+1]);
i=0;
}
}
printf("%s\n",a);
}程序的运行结果是()。
第939题
有以下程序:
#include <stdio.h>
#include <string.h>
main()
{
char a[5][10]= {"china", "beijing", "you", "tiananmen", "welcome"};
int i,j;
char t[10];
for(i=0;i<4;i++)
for(j=i+1;j<5;j++)
if(strcmp(a[i],a[j])>0)
{
strcpy(t,a[i]);
strcpy(a[i],a[j]);
strcpy(a[j],t);
}
puts(a[3]);
}程序运行后的输出结果是()。
第940题
有以下程序(strcat函数用以连接两个字符串):
#include <stdio.h>
#include <string.h>
main()
{
char a[20]="ABCD\0EFG\0", b[]="IJK";
strcat(a,b);
printf("%s\n",a);
}程序运行后的输出结果是()。