A: char t[6][20]; t[1] = "Game";
B: char t[ ][20]={ "Game"};
C: char *t[6]; t[1]= "Game";
D: char t[ ]={ "Game"};
举一反三
- 下列不能输出字符串"Hello"的程序段是______。 A: char *t; t="Hello";printf("%s\n",t); B: char *t, s[]="Hello"; t=s;printf("%s\n",t); C: char s[20],*t=s; t="Hello";printf("%s\n",s); D: char *t, s[]="Hello"; t=s;printf("%s\n",s);
- 下列语句中存在语法错误的是______。 A: char ss[]={ "right? "}; B: char ss[ ][20]={ "right? "}; C: char *ss[6]; ss[1]= "right? "; D: char ss[6][20]; ss[1]= "right? ";
- 调用下列哪个函数,能交换两个指针的指向()。 char str[]="China"; char *p1 = str, *p2 = “加油”; Swap (p1, p2); cout<< p1 << p2; // 加油China A: void Swap(char *p, char *q){ char *t = 0; t=p; p=q; q=t;} B: void Swap(char* p, char *q){ char t; t=*p;*p=*q;*q=t;} C: void Swap(char * *p, char * *q){ char* t = 0; t=*p;*p=*q;*q=t;} D: void Swap(char* &p, char * &q){ char* t = 0; t=p; p=q; q=t;}
- void main(){char s[20]; char *t; t= t + 7 ;}
- 以下语句中存在语法错误的是 A)char ss[6][20]; ss[1]="right?"; B)char ss[][20]={"right?"}; C)char *ss[6]; ss[1]="right?"; D)char *ss[]={"right?"};
内容
- 0
以下与库函数strcmp(char *s,char *t)功能相等的程序段是( )。? int strcmp3(char *s,char *t){ for ( ; *t==*s; ) { if (!*t) return 0 ; t++ ; s++ ; } return (*s-*t) ;}|int strcmp2(char *s,char *t){ for ( ; *s++==*t++; ) if (!*s) return 0 ; return (*s-*t) ;}|int strcmp1(char *s,char *t){ for ( ; *s++==*t++; ) if (*s=='\0') return 0 ; return (*s-*t) ;}|int strcmp4(char *s,char *t){ for ( ; *s==*t;s++,t++ ) if (!*s) return 0 ; return (*t-*s) ;}
- 1
中国大学MOOC: 下面程序 char * fun1(char *t,char *s){ while(*t=*s){s++,t++;} return t;}int main(){ char a[100]=Hello; char b[20]=NEU; char *t=NULL; t=fun1(a,b); printf(%s,t);}执行结果为
- 2
下面程序 char * fun1(char *t,char *s){ while(*t=*s){s++,t++;} return t;}int main(){ char a[100]="Hello"; char b[20]="NEU"; char *t=NULL; t=fun1(a,b); printf("%s",t);}执行结果为 A: HelloNEU B: Hello C: NEU D: 输出为空
- 3
以下正确的程序段是: char *s; scanf("%s", s);|char s[20], *t=s;scanf("%s", t[2]);|char s[20]; scanf("%s", &s);|char s[20]; scanf("%s", &s[2]);
- 4
1 can’t help thinking it would be fun to play such an exciting game with them.