单选题
C语言
题号 #2546341
有以下程序:
void funl(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
答案解析
A。【解析】本题中使用了函数的调用,由funl函数中的while循环可知,循环的作用是为了把q所指向的内容增加l,而从主函数传到函数时是从下标为3开始传,因此当调用函数执行完后,传过去的字符串为’hsbn’,前面不变。
你可能感兴趣的试题
1
若有以下的说明和语句,则在执行for语句后,*(*(pt+1)+2)表示的数组元素是( )。
im t[3][3],*pt[3],k;for(k=0;k<3;k++)pt[k]-&t[k][o];
im t[3][3],*pt[3],k;for(k=0;k<3;k++)pt[k]-&t[k][o];
A.t[2]Eo]
B.t[2][2]
C.tell[2]
D.t[2][1]
A.21,43
B.43,21
C.43,00
D.21,00
A.#include<stdi0.h>
void swap(int。P,int+q)
( int*t,a;
t=&a;*t=*P;*p=*q;*q=*t;
)
main()
{ int a=10,b=20;
swap(&a,&b);printf(”%d%dkn”,a,b);
)
void swap(int。P,int+q)
( int*t,a;
t=&a;*t=*P;*p=*q;*q=*t;
)
main()
{ int a=10,b=20;
swap(&a,&b);printf(”%d%dkn”,a,b);
)
B.#include<stdio.h>
void swap(int*p,int*q)
{ int t;
t=*P;*P=*q;*q=t;
}
main()
{ int a-10,b-20;
swap(&a,&b);printf(”%d%d\n”,a,b);
)
void swap(int*p,int*q)
{ int t;
t=*P;*P=*q;*q=t;
}
main()
{ int a-10,b-20;
swap(&a,&b);printf(”%d%d\n”,a,b);
)
C.#included stdi*.h>
void swap(int*P,int*q)
{ int t;
t=*P;*P=*q;*q=t;
)
main()
{ int*a,*b;
*a=10,*b=20:
swap(a,b);printf(”%d%d\n”,*a,*b);
)
void swap(int*P,int*q)
{ int t;
t=*P;*P=*q;*q=t;
)
main()
{ int*a,*b;
*a=10,*b=20:
swap(a,b);printf(”%d%d\n”,*a,*b);
)
D.#include<stdio.h>
void swap(int*P,int*q)
( int t;
t=*P;*P=*q;*q=t;
)
main()
{ int a=10'b=20,*x=&a,*y=&b;
swap(x,y);print{(”%d%d\n”,a,b);
)
void swap(int*P,int*q)
( int t;
t=*P;*P=*q;*q=t;
)
main()
{ int a=10'b=20,*x=&a,*y=&b;
swap(x,y);print{(”%d%d\n”,a,b);
)