单选题有以下程序#includemain(){ intn,*p=NULL; *p=n; printf(Inputn:); scanf(%d,p); printf(outputn:); printf(%d,p);}该程序试图通过指针p为变量n读入数据并输出,但程序有多处错误,以下语句正确的是(  )。

单选题
有以下程序 #include  main() {  int n,*p=NULL;  *p=&n;  printf(Input n:);  scanf(%d,&p);  printf(output n:);  printf(%d,p); } 该程序试图通过指针p为变量n读入数据并输出,但程序有多处错误,以下语句正确的是(  )。

参考解析

解析:
B项的正确写法应为“p=&n;”,将变量n的地址赋给指针p;C项的正确写法应为“scanf("%d",p);”;D项的正确写法应为“printf("%d",*p);”。答案选择A选项。

相关考题:

有以下程序#include stdio.hmain( ){ int n,*p=NULL;*p=n;printf("Input n:"); scanf("%d",p); printf("output n:"); printf("%d\n",p);}该程序试图通过指针 p 为变量 n 读入数据并输出,但程序有多处错误,以下语句正确的是A)int n,*p=NULL;B)*p=n;C)scanf("%d",p)D)printf("%d\n",p);

有以下程序 #include main() {int n,*p=NULL; *p=n; printf(“Input n:”); scanf(“%d”,p); printf(“output n:”); printf(“%d\\n”,p); }该程序试图通过指针p为变量n读入数据并输出,但程序有多处错误,以下语句正确的是( )。A.int n,*p=NULL;B.*p=n;C.scanf(“%d”, p)D.printf(“%d\n”,p);

有以下程序#include stdio.hvoid fun(int p){ int d=2;p=d++; printf("%d",p);}main(){ int a=1;fun(a); printf("%d\n",a);}程序运行后的输出结果是A)32B)12C)21D)22

有以下程序 include main() { int n,*p=NULL; *p=n; printf(" 有以下程序 #include <stdio.h> main() { int n,*p=NULL; *p=n; printf("Input n:");scanf("%d",p);printf("output n:");printf("%d\n",p); } 该程序试图通过指针p为变量n读入数据并输出,但程序有多处错误,以下语句正确的是A.int n,*p=NULL;B.*p=n;C.scanf("%d",p)D.printf("%d\n",p);

为使*p=20,下面正确的程序是()A. include main( ) { int a=10,b=20,*p= printf 为使*p=20,下面正确的程序是 ( )A.# include<stdio.h> main( ) { int a=10,b=20,*p=&b; printf("%d\t%d\n",p,*p); } *p)B.# include<stdio.h> main( ) { int a=10,b=20,*p=b; printf("%d\t\%d\n",p,*p) }C.# include<stdio.h> main( ) { int a=10,b=20,*p; p=&a; p + +; printf("%d\t\%d\n",p,*p);} }D.# include<stdio.h> main( ) { int a=10,b=20,*p; *p=20; printf("%d\t\%d\n",p,*p); }

有以下程序:inlucdemain()D)2 3 3{int n,*P=NULL;*p=printf("input n:");scanf("%d 有以下程序: #inlucde<stdio.h> main()D)2 3 3 {int n,*P=NULL; *p=&n; printf("input n:");scanf("%d",&p);printf("output n:");printf("%d\n",p); } 该程序试图通过指针P为变量n读入数据并输出,但程序有多处错误,以下语句正确的是( )。A.int n,*P=NULL;B.*P=&n;C.scanf(“%d",&p)D.printf("%d\n",p);

有以下程序:includevoid fun(char**p){++P;printf("%s\n",*p);}main()char*a[]={"Morn 有以下程序: #include<stdio.h> void fun(char**p) { ++P;printf("%s\n",*p);} main() char*a[]={"Morning","Afternoon","Evening","Night"}; fun(A); } 程序的运行结果是( )。A.AfternoonB.fternoonC.MorningD.oring

有以下程序: includemain(){ char str[][20]={"Hello","Beijing"},*p=str;printf("% 有以下程序: # include<string.h> main() { char str[][20]={"Hello","Beijing"},*p=str; printf("%d\n",strlen(p+20)); } 程序运行后的输出结果是 ______。A.0B.5C.7D.20

有以下程序: include point ( char * p) {p + = 3; }main( ) char b[4] = {'a','b','c 有以下程序: #include <stdio.h>point ( char * p) { p + = 3; }main( ) char b[4] = {'a','b','c','d'} , *p=b; point(p); printf( "% c \n" , * p);A.aB.bC.cD.d

有以下程序 include void fun(char **p) { ++p; printf("%s\n",*p); 有以下程序 #include <stdio.h> void fun(char **p) { ++p; printf("%s\n",*p); } main() { char *a[]={"Moming","Afternoon","Evening","Night"}; fun(a); } 程序的运行结果是A.AfternoonB.fternoonC.MorningD.orning

有以下程序:includemain(){charstr[][20]={"Hello","Beijing"}*p=str;printf("%\n",s 有以下程序: #include <string.h> main() { char str[][20]={"Hello","Beijing"}*p=str; printf("%\n",strlen(p+20)); } 程序运行后的输出结果是A.0B.5C.7D.20

有以下程序: include main( ) {char s[ ] ="159" , * p;p=s;printf( "% c", * p + + 有以下程序: #include <stdio.h> main( ) { char s[ ] ="159" , * p; p=s; printf( "% c", * p + + ); printf("%~", * p++);}程序运行后的输出结果是( )。A.15B.16C.12D.59

有以下程序includemain(){charstr[][20]={"Hello","Beijing"},*p=str;printf("%d\n", 有以下程序 #include <string.h> main() {char str[][20]={"Hello","Beijing"},*p=str; printf("%d\n",strlen(p+20)); } 程序运行后的输出结果是A.0B.5C.7D.20

有以下程序#include stdio.hmain { int n,*p=NULL; *p=n; printf("Input n:"); scanf("%d",p); printf("output n:"); printf("%d\n",p);}该程序试图通过指针p为变量n读入数据并输出,但程序有多处错误,以下语句正确的是A.int n,*p=NULL; B.*p=n; C.scanf("%d",p) D.printf("%d\n",p);

以下程序运行时若要正确输出函数的入口地址和输入数的绝对值,应在程序空缺处填入的正确选项是 ( )。 abs(int x) { if(x>=0)return x: else return -x;} main() { int y,z,(*p)(int x)=abs; scanf(" %d" ,y); z=(*p)(y); ______;}A.printf(" %d%d\n" ,p,z)B.printf(" %d%d\n" ,p,z)C.printf(" %d%d\n" ,*p,z)D.Printf(" %d%d\n" ,p,*z)

有以下程序: #include stdio.h main( ) { struct node{int n; struct node*next;} *P; struct node x[3]={{2,x+1),{4,x+2},{6,NULL}}; P= X; printf("%d,",p-n); printf("%d\n",p-next-n); } 程序运行后的输出结果是( )。A.2,3B.2,4C.3,4D.4, 6

有以下程序includemain(){char *p=“abcde、Ofghjik\0”;printf(“%d\n”,strlen(p));} 程 有以下程序 #include<string.h> main() { char *p=“abcde、Ofghjik\0”; printf(“%d\n”,strlen(p)); } 程序运行后的输出结果A.12B.15C.6D.5

有以下程序include main(){ char *p,*q;p=(char*)malloc(sizeof(char)*20);q=p;scanf 有以下程序 #include <stdlib.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 defB.abc delC.abc dD.d d

有以下程序:includemain(){char *p="abcde\Ofghjik\0";printf("%d\n",strlen(p));}程 有以下程序: #include <string.h> main() {char *p="abcde\Ofghjik\0"; printf("%d\n",strlen(p)); } 程序运行后的输出结果是( )。A.12B.15C.6D.5

若有以下程序main(){ int p=5,a=5; if(p=1!=0) printf("%d\n",p); else printf("%d\n",p+2);}程序执行后的输出结果是

有以下程序l该程序试图通过指针P为变量n读人数据并输出,但程序有多处错误,以下语句正确的是( )。

有以下程序:include main( ){ehar str[ ] [10] = { "China" ," Beijing" } , * p = 有以下程序: #include < stdio. h > main( ) { ehar str[ ] [10] = { "China" ," Beijing" } , * p = str[o]; printf( "% s \n", p + 10); }程序运行后的输出结果是( )。A.ChinaB.BeijingC.ngD.ing

有以下程序:include main( ){char P[] = {'a','b','c'} ,q[]: "abc";printf( "% d % d 有以下程序:#include <stdio.h>main( ){ char P[] = {'a','b','c'} ,q[]: "abc"; printf( "% d % d \ n", sizeof(p), sizeof(q) );}程序运行后的输出结果是( )。A.44B.33C.34D.43

有以下程序include.main(){char*p="abcde\ofghjik\0";printf("%d\n",strlen(p));} 程 有以下程序 #include.<string.h> main() { char *p="abcde\ofghjik\0"; printf("%d\n",strlen(p)); } 程序运行后的输出结果是A.12B.15C.6D.5

有以下程序该程序试图通过指针p为变量rl读人数据并输出,但程序有多处错误,以下语句正确的是( )。A.AB.BC.CD.D

有以下程序: include main( ) { char *p="abcde\0ghjik\0"; printf("%d\n",str 有以下程序: #include<string.h> main( ) { char *p="abcde\0ghjik\0"; printf("%d\n",strlen(p) ); } 程序运行后的输出结果是A.12B.15C.6D.5

单选题有以下程序:#include main(){ struct node {  int n;  struct node *next; } *p; struct node x[3] = {{2,x+1},{4,x+2},{6,NULL}}; p=x; printf(%d,,p-n); printf(%d,p-next-n);}程序运行后的输出结果是(  )。A2,3B2,4C3,4D4,6