以下程序的结果是( )。 #include<iostream.h> void main() {char*p="abcdefgh",*r; long*q; q=(1ong*)P; q++; r=(char*)q; cout<<r<<endl;=
A.defg
B.cdef
C.ghab
D.efgh
第1题:
有以下程序 #include<string.h> main() { char p[20]={'a','b','c','d'},q[]="abc",r[]="abcde"; strcpy(p+strlen(q),r);strcat(p,q); printf("%d%d\n",sizeof(p),strlen(p)); } 程序运行后的输出结果是
A.20 9
B.9 9
C.20 11
D.11 11
第2题:
有以下程序: #include<string.h> main() {char p[20]={'a','b','c','d'),q[]="abc",r[]="abcde" strcat(p,r);strcpy(p+strlen(q),q); printf("%d\n",sizeof(p)); } 程序运行后的输出结果是( )。
A.9
B.6
C.11
D.7
第3题:
有以下程序
void fun1(char *p)
{ char *q;
q=p;
while(*q!='\0')
{ (*q)++; q++; ) }
}
main()
{ char a[]={"Program"),*p;
p=&a[3];fun1(p);printf(" % s\n",a);
}
程序执行后的输出结果是
A)Prohsbn
B)Prphsbn
C)Progsbn
D)Program
第4题:
下面程序的运行结果是【 】。
include<iostream.h>
void main()
{
char s[]="9876",*p;
for(p=s;p<s+2;p++)
cout<<p;
}
第5题:
若有以下程序段:
include <iostream>
using namespace std;
int main()
{
char*p="abcdefgh",*r;
long*q;
q=(long*)p;q++;
r=(char*)q;
cout<<r<<end1;
return 0;
}
该程序的输出结果是【 】。
第6题:
有以下程序 #include<string.h> main() { char p[20]={'a','b','c','d'},q[]="abc",r[]="abcde"; strcat(p,r);strcpy(p+strlen(q),q); printf("%d\n",strlen(p)); } 程序运行后的输出结果是
A.9
B.6
C.11
D.7
第7题:
有以下程序: # include<stdio.h> main() { char*p,*q; p=(char *)malloc(sizeof(char)* 20);q=p; scanf("%s %s",p,q);printf("%s %s\n",p,q); } 若从键盘输入;abc def<回车>,则输出结果是 ______。
A.def def
B.abc def
C.abe d
D.d d
第8题:
有以下程序: void fun1(char*p) {char*q; q=P; while(*q!='\0') { (*q)++;q++;} } main() {char a[]={"Program"),*p; p=&a[3];funl(p);printf("%s\n",A); } 程序执行后的输出结果是( )。
A.Prohsbn
B.Prphsbn
C.Progsbn
D.Program
第9题:
有以下程序:
void funl(char*p)
{ char*q;
q=P;
while(*q!='\O')
{(*q)++;q++;}
}
main
{ char a[]={"Program"),*P;
p=&a[3];funl(p);
printf("%s\n",a);
}
程序执行后的输出结果是( )。
A.Prohsbn
B.Prphsbn
C.Progsbn
D.Program
第10题:
以下程序的输出结果是【 】。
include<iostream. h>
void main() {
char *p= "12345678" , *r;
long *q;
q=(long *)p;
q++;
r= (char *) q:
cout<<r;
}