首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include <stdio.h> main() { int n,*p=NULL; *p=&n; printf("Input n:");scanf("%d",&p);printf("output n:");p
有以下程序 #include <stdio.h> main() { int n,*p=NULL; *p=&n; printf("Input n:");scanf("%d",&p);printf("output n:");p
admin
2013-06-11
25
问题
有以下程序 #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);
答案
A
解析
指针变量在定义时需要加星号,而在赋值时则不用,故选项B)错误。本题中,scanf()函数和printf()函数都是要对指针变量p指向的地址处的数据进行访问,不是变量本身。选项C)中多了取地址运算符,选项D)中少了指针运算符。
转载请注明原文地址:https://kaotiyun.com/show/5wJp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
如下程序的输出结果是______。#include<stdio.h>main(){intx,a=3,b=4;for(x=0;x<3;x++){switch(x){case
如下程序的输出结果是______。 #include<stdio.h> main() { int x=1,a=3,b=4; switch(x) { case 0:a--; case 1:b--; case 2:a--;b--; } printf("a=%d
下列程序的运行结果是______。
有以下程序 main() { int m=0256,n=256; printf("%0 %o\n",m,n); } 程序运行后的输出结果是______。
结构化程序设计方法的主要原则可以概括为自顶向下、逐步求精、______和限制使用goto语句。
以下程序通过函数sunFun求f(x)。这里f(x)=x2+1,由F函数实现。请填空。main(){printf("Thesum=%d\n",SunFun(10));}SunFun(intn){int
有以下结构体说明和变量的定义,且如图14-4所示的指针p指向变量a,指针q指向变量b。则不能把结点b连接到结点a之后的语句是______。struct node { char data; struct node * next; }a,b,*p=&a,*
C语言源程序的最小单位是()。
在C语言中,关于函数fseek的说法正确的是()。
待排序的关键码序列为(33,18,9,25,67,82,53,95,12,70),要按关键码值递增的顺序排序,采取以第一个关键码为基准元素的快速排序法,第一趟排序后关键码33被放到第()个位置。
随机试题
深静脉血栓形成(下肢的DVT)的患者,约半数以上无自觉症状和明显体征,此时依据双侧下肢周径的测量结果来评价,双侧相差多少即可考虑有临床意义
我国水利面临的新形势是()。
填方土料应符合设计要求,一般不能选用的有()。
出境货物最迟于报关或装运前7天报检。( )
态度的结构包括认知成分、_________和行为成分。
Tom’smothertriedhardtopersuadehimto______fromhisintentiontoinvesthissavingsinstockmarket.
Accordingtotheauthor,the"SpaceRace"was______.Theauthorbringsupthetopicoftheinternationalspacestationinorder
某货车运输公司有一个中央仓库和n个运输目的地,每天要从中央仓库将货物运输到所有运输目的地,到达每个运输目的地一次且仅一次,最后回到中央仓库。在两个地点i和i之间运输货物存在费用Cij,为求解旅行费用总和最小的运输路径,设计如下算法:首先选择离中央仓库最近的
关于QoS协议特点的描述中,错误的是()。
It’sacharacter______inhimthathecan’teveracceptthathe’sinthewrong.
最新回复
(
0
)