单选题 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’,前面不变。

你可能感兴趣的试题

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);
)
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);
)
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);
)
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);
)
找试题 · 找答案 · 找资料 在线模考