首页/ 题库 / [单选题]有以下程序:include <stdio的答案

有以下程序:include <stdio.h> main( ) { int a=7,b=8,* p,*q, *r; p=&a;q=&b; r=p; p=q;q=r; printf(" % d,% d,% d,% d \n", * p, * q.a,b);程序运行后的输出结果是()。

单选题
2022-06-15 21:27
A、8,7,8,7
B、7,8,7,8
C、8,7,7,8
D、7,8,8,7
查看答案

正确答案
C

试题解析
程序中P和q是指针变量,它们分别存放了变量a和L的地址,执行P=&a;q= &b;语句后,*p和*q的值就分别为7和8,执行r=P;P=q;q=r;实际上是进行指针变量p和 q的交换,即将其存放的a和b的地址进行了交换,也就是P指向了b,q指向了a,此时a,b的值并没有改变,所以输出的*P,*q的值为8,7,而a,b的值仍为7,8。

标签:
感兴趣题目
有以下程序:include <stdio.h> main( ) { int a=7,b=8,* p,*q, *r; p=&a;q=&b; r=p; p=q;q=r; printf(" % d,% d,% d,% d ", * p, * q.a,b);程序运行后的输出结果是()。
以下程序的输出结果是( )。 #include<stdio.h> main() {int a=4,b=3,c=2,d=1; printf("%d",a<b?a:d<c?d:B); }
以下程序的输出结果是( )。 #inClude<stdio.h> main() { int a,b,d=241; a=d/100%9; b=(-1)&&(+1); printf("%d,%d",a,b); }
以下程序的输出结果是( ) #include<stdio.h> main() {int a,b, d=241; a=d/100%9 b=(-1)&&(+1); printf("%d,%d,a,d");}
请读程序: #include<stdio.h> main() { int a=5,b=7,c=9; pintf("%d,%d,"a,b,C) ; printf("%d,%d",a,D) ; } 上面程序的输出结果是_______。
有以下程序: #include <stdio. h> main( ) { unsigned int a; int b=-1; a=b; printf(" % u", a);程序运行后的输出结果是( )。
有以下程序: #include<stdio.h> main() { int a[]={1,2,3,4},y,*p=&a[3]; --p;y=*p;printf("y=%d ",y); } 程序的运行结果是( )。
有以下程序 #include<stdio.h> main() { int a=5,b=lt; t=(a<<2)|b;printf("%d ",t); } 程序运行后的输出结果是______。
有以下程序 #include<stdio.h> void main() { int a=1,b=0; printf("%d,",b=(a++)+(a++)); pfintf("%d ",a+B); } 程序运行后的输出结果是( )。
有以下程序: #include<stdio.h> main() { int a=1,b=2,c=3,x; x=(a^B)&c;printf("%d ",x); } 程序的运行结果是( )。
有以下程序 #include<stdio.h> intfun(int a,intB){if(b=0)return a; else return(fun(--a,--B)); } main() {pdntf("%d ",fun(4,2));} 程序的运行结果是( )。
以下程序的输出结果是( )。 #include <stdio.h> main() { int a=21,b=11; printf("%d ",--a+b,--b+a); }
相关题目
下面程序的运行结果是( )。 #include <stdio.h> main() { int a=1,b=10; do {b-=a;a++;}while(b--<0); printf("a=%d,b=%d ",a,b); }
以下程序调用scanf函数给变量a输入数值的方法是错误的,其错误原因是( )。 #include <stdio.h> main() { int *p,*q,a,b; p=&a; printf("input a:"); scanf("%d",*p); }
以下程序的输出结果是 ( ) #include<stdio.h> main() {struct stru{int a,b: char c[6]; }: printf("%d ",sizeof(stru)), }
有以下程序:#include main(){ int x=011; printf(%d,++x);}程序运行后的输出结果是(  )。
有以下程序:#include #include main(){ char a[20]=ab,b[20]=cdef; int k=0; strcat(a,b); while(a[k]!='\0') {  b[k]=a[k];  k++; } puts(b);}程序的运行结果是(  )。
有以下程序#include void  fun(char *a, char *b){ while(*a=='*') a++; while(*b=*a) {  b++;  a++; }}main(){ char *s=*****a*b**** , t[80]; fun(s,t); puts(t);}程序的运行结果是(  )。
有以下程序: #include <stdio.h> main() { int a=1,b=2,c=3,x; x=(ab)&c; printf("%d ",x); } 程序的运行结果是( )。
有以下函数:#include main(){ int a=12,c; c=(a<<2)<<1; printf(%d,c);}程序运行后的输出结果是(  )。
有以下程序: #include <stdio.h> fun(int x,int y,int z) { z=x*y;} main() { int a=4,b=2,c=6; fun(a,b,c); printf("%d",c); } 程序运行后的输出结果是( )。
有以下程序:#include main(){ int a=3; int b=3; printf(%d, a&b);}程序运行后的输出结果是(  )。
有以下程序:#include int fun(int a,int b){ if(b==0)return a; else return(fun(--a,--b));}main(){ printf(%d,fun(4,2));}程序运行的结果是(  )。
有以下程序:#includestruct S{int a;int *b;};main(){ int x1[] = {3,4},x2[] = {6,7}; struct S x[] = {1,x1,2,x2}; printf(%d,%d,*x[0].b,*x[1].b);}程序的运行结果是(  )。
有以下程序#includeint fun(int a,int b){ return a+b;}main(){ int x = 6,y=7,z = 8,r; r = fun(fun(x,y),z--); printf(%d,r);}程序运行后的输出结果是(  )。
有以下程序: #include<stdio.h> main( ) { int a=-2,b=0; while(a++++b); printf("%d,%d ",a,b); } 程序运行后的输出结果是( )。
下列程序的输出结果是( )。 #include <stdio.h> int b=2; int func(int *a) { b+=*a;return(b);} main() { int a=2, res=2; res+=func(&a); printf("%d ",res); }
有以下程序#include main(){ int i=1; i=i^i; printf(%d,i);}程序运行后的输出结果是(  )。
以下程序的运行结果是 ( ) # include<stdio.h> main( ) { int a=015,b=22; printf("%d,%d ",a+ +,- -b); }
有以下程序: #include <stdio.h> main( ) { int a=7; while(a--); print[("%d ",a); } 程序运行后的输出结果是( )。
有以下程序: #include <stdio.h> main( ) { int a=2,b; b=a<<2;printf("%d ",b); } 程序运行后的输出结果是( )。
有以下程序:include <stdio.h> main( ) { int a=7,b=8,* p,*q, *r; p=&a;q=&b; r=p; p=q;q=r; printf(" % d,% d,% d,% d \n", * p, * q.a,b);程序运行后的输出结果是()。
广告位招租WX:84302438

免费的网站请分享给朋友吧