计算机二级C语言程序设计
VIP题库
以下程序的运行结果是______。#include #include main(){ char s[20]="Game over"; int i; i=0; while(s[i]!=0) { if(i%3==0) putchar(s[i]); i++; } for(i=strlen(s)-1;i>=0;i--) if(i%3==0) putchar(s[i]); printf("\n");}
有以下程序void swap(char *x,char *y){ char t;t=*x;*x=*y;*y=t;}main(){ char *s1="abc",*s2="123";swap(s1,s2); printf("%s,%s\n",s1,s2);}程序执行后的输出结果是______。
有以下程序#include main(){char name[10] = {''S'', ''T'', ''R''};name[2] = ''#''; name[6] = 0;printf("%s\n", name);}程序运行后的输出结果是______。
设有定义:char s[81];int i=0;,以下不能将一行(不超过80个字符)带有空格的字符串正确读入的语句或语句组是______。
有下列程序#include int fun(char *s,char *t){int c=0;char *p, *q;while(*s){p=s;q=t;while(*p && *q && *p++ == *q++);if(!*q) c++;s++;}return c;}void main(){char *str1="celebration meeting", *str0="ti";printf("%d\n",fun(str1,str0));}程序执行后的输出结果是______。
有以下程序#include int fun( char s[] ){char *p = s;while( *p != 0 ) p++;return ( p-s );}main(){printf("%d\n", fun("0ABCDEF") );}程序运行后的输出结果是______。
有以下程序#include #include main(){ int i;char a[]="How are you!";for (i=0; a[i]; i++)if (a[i] == '' '')strcpy(a, &a[i+1]);printf("%s\n",a);}程序的运行结果是______。
在32位编译器上,设有定义 char *str1 = "Hello", str2[] = "Hello"; ,则以下语句printf("%d %d", sizeof(str1), sizeof(str2));的输出结果是______。
有以下说明语句char *s = "\"Name\\Address\n";指针s所指字符串的长度是______。
有以下程序#include char *a = "you";char *b = "Welcome you to Beijing!";main(){ char *p;p = b;while (*p != *a) p++;printf("%s\n", p);}程序运行后的输出结果是______。
«
1
2
...
34
35
36
37
38
39
40
...
149
150
»