网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

4、4、若有定义语句: int year=2009, *p=&year;,以下不能使变量year中的值增至2010的语句是()

A.*p+=1;

B.(*p)++;

C.++(*p);

D.*p++;


参考答案和解析
D 解析:++的优先级比木的高,所以先运算p++,使得p指向了year变量的下一个存储单元中的内容,然后在取其中的值,得到的一个没有意义的数字,*p++自然就不对了。
更多 “4、4、若有定义语句: int year=2009, *p=year;,以下不能使变量year中的值增至2010的语句是()A.*p+=1;B.(*p)++;C.++(*p);D.*p++;” 相关考题
考题 设有说明struct DATE { int year;int month; int day;};请写出一条定义语句,该语句定义 d 为上述结构体 类型 变量,并同时为其成员 year 、 month 、 day 依次赋初值 2006 、 10 、 1 : 【 19 】 。

考题 ( 38 )有以下定义和语句struct workers{ int num;char name[20];char c;struct{ int day; int month; int year; } s;} ;struct workers w,*pw;pw = w;能给 w 中 year 成员赋 1980 的语句是A ) *pw.year = 198O;B ) w.year=1980;C ) pw-year=1980;D ) w.s.year=1980;

考题 设有说明struct DATE{int year;int month; int day;};请写出一条定义语句,该语句定义d为上述结构体变量,并同时为其成员year、month、day 依次赋初值2006、10、1:_________;

考题 请在每条横线处填写一个语句,使程序的功能为:判断输入的年份是否为闰年(例如:1998年不是闰年,2000年是闰年).注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。import java.io.*;public class LeapYear{public static void main(String args[]){___________________;BufferedReader in;ir=new InputStreamReader(_____________________________);in=new BufferedReader(ir);System. out. print In("输入年份是: ");String s=in.readline();int year=___________________if(year%4==0year%100!=0||year%400==0System.out.println(" "+year+" "年是闰年. ");elseSystem.out.println(" " +year+ " "年不是闰年.");}}}

考题 若有定义语句:"int a[4][10],*P,*q[4];"且0≤i 若有定义语句:"int a[4][10],*P,*q[4];"且0≤iA.D=aB.q[i]=a[i]C.p=a[l]D.P=&a[2][1]

考题 已知学生记录描述为 struct student { int no; char name[20]; char sex; struct { int year; int month; int day; } birth; }; struct student s;变量s中的“生日”应是“1985年4月4日”,下列对“生日”的正确赋值方式是______。A.year=1985;month=4;day=4;B.birth.year=1985;birth.month=4;birth.day=4;C.s.year=1985;s.month=4;s.day=4;D.s.birth.year=1985;s.birth.month=4;s.birth,day=4;

考题 若有一些定义和语句 include int a=4,b=3,*p,*q,*w; p=a; q=b; w=q; q 若有一些定义和语句 #include <stdio.h> int a=4,b=3,*p,*q,*w; p=a; q=b; w=q; q=NULL; 则以下选项中错误的语句是A.*q=0;B.w=p;C.*p=va;D.*p=*w;

考题 请补充fun函数,该函数的功能是:判断一个年份是否为闰年。例如,1900年不是闰年,2004是闰年。[注意] 部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。[试题源程序]include<stdio.h>include<conio.h>int fun(int n){int fiag=0;if(n%4==0){if( (1) )fiag=1;}if( (2) )flag=1;return (3) ;}void main(){int year;clrscr();printf("Input the year:");scanf("%d", &year);if(fun(year))printf("%d is a leap year.\n", year);elseprintf("%d is not a leap year.\n", year);}

考题 下面程序是判断某一个是否为闰年,请改正程序中的错误(有下划线的语句),使程序能输出正确的结果。(闰年的条件是符合下面两者之一:①能被4整除,但不能被100整除;②能被4整除,又能被100整除)。注意:不改动程序的结构,不得增行或删行。import java.io.*;public class LeapYear{public static void main(String args[]){int year=1979;if((year %4= =0 || year % 100 !=0) || (year % 400= =0))System.out.println(year+"是闰年.");elseSystem.out.println(year+"不是闰年。");year=2000;boolean leap;if(year % 4 !=0)leap=false;else if(year % 100 !=0)leap=true;else if(year % 400 !=0)leap=false;elseleap=true;if(______)System.out.println(year+"是闰年。");elseSystem.out.println(year+"不是闰年。");year=2010;if(year % 4= =0){if(year % 100= =0){if(year % 400= =0)leap=true;else______}elseleap=false;}if(1eap= =true);System.out.println(year+"是闰年。");elseSystem.out.println(year+"不是闰年。");}}

考题 有如下定义语句:int a[]={1,2,3,4,5};,则对语句int*p=a;正确的描述是( )。A.语句int*p=a;定义不正确B.语句int*p=a;初始化变量p,使其指向数组对象a的第一个元素C.语句int*p=a;是把a[0]的值赋给变量pD.语句iht*p=a;是把a[l]的值赋给变量p

考题 若有定义:int a=10,b=8,c=4:然后顺序执行下列语句后,变量a中的值是__________。c=(b-=(a-4));a=(c%2) (b-1);

考题 下面结构体的定义语句中,不正确的是______。A.structdate { int month; int day; int year; } Struct date datel;B.stmctdate { intmonth; int day; int year; } datel;C.struct { int month; int day; int year; } date 1;D.#define DATE stmct date DATE { int month; int day; int year; }datel;

考题 有如下定义语句:int a[]={1,2,3,4,5);,则对语句int *p=a;正确的描述是( )。A.语句int *p=a;定义不正确B.语句int *p=a;初始化变量p,使其指向数组对象a的第一个元素C.语句int *p=a;是把a[0]的值赋给变量pD.语句int *p=a;是把a[1]的值赋给变量p

考题 有定义语句:int*p[4],以下选项中与此语句等价的是( )。A.int p[4];B.int**p;C.int*(p[4]);D.int(*p)[4];

考题 若有以下定义和语句:includeinta=4,b=3,*p,*q,*w;p=a; q=b; w=q; q=NULL;则 若有以下定义和语句: #include<stdio.h> int a=4,b=3,*p,*q,*w; p=a; q=b; w=q; q=NULL; 则以下选项中错误的语句是( )。A.*q=0;B.w=p;C.*p=a;D.*p=*w;

考题 若有定义语句:“int year=2009,*p=year;”,以下不能使变量year中的值增至2010的语句是( )。A.*p+=1;B.(*p)++;C.++(*p);D.*++P

考题 已知year为整型变量,不能使表达式(year%4==0year%100!=O)||year%400==0的值为“真”的数据是______。A.1990B.1992C.1996D.2000

考题 有以下定义和语句,则sizeof(a) 的值是【 】,而sizeof(a,share)的值是【 】struct date{ int day;int mouth;int year;union{int share1;float share2;}share;}a;

考题 有以下定义和语句,则sizeof(a.share)的值是( )。struct date{ unsigned int day;unsigned int mouth;unsigned int year;union{int share1;float share2;}share;}a;

考题 若有定义“floata=25,b,*p=&b;”,则下列对赋值语句“*p=a;”和“p=&a;”的正确解释为( )。A.两个语句都是将变量a的值赋予变量pB.*p=a是使P指向变量a,而P=&a是将变量的值赋予变量指针pC.*p=a是将变量a的值赋予变量b,而&a是使P指向变量aD.两个语句都是使p指向变量a

考题 若有定义语句:double a,+P=a;以下叙述中错误的是( )。A.定义语句中的*号是一个问址运算符 若有定义语句:double a,+P=a把变量a的地址作为初值赋给指针变量P

考题 若有定义语句:int year=2009,*p=year;,以下不能使变量year中的值增至2010的语句是A.*p+=1;B.(*p)++;C.++(*p);D.*p++;

考题 某C语言结构体的定义如下。 struct date { int year, month, day; }; struct worklist { char name[20]; char sex; struct date birthday; }person; 若对变量person的出生年份进行赋值,正确的赋值语句是(33)。A.year=1976B.birthday. year=1976C.person. year=1976D.person. birthday. year=1976

考题 有定义语句:“int*p[4];”,以下选项中与此语句等价的是( )。 A.int p[4];B.int**P;SXB 有定义语句:“int*p[4];”,以下选项中与此语句等价的是( )。A.int p[4];B.int**P;C.int*(p[4]);D.int(*p)[4];

考题 有下列语句:  struct Birthday{public int year;  public int month;   public int day;}; struct Student{ int no;  string name;   int age;  public Birthday bir; };  ……  Student Stu;  如果要把Stu的出生年份赋值为1988,正确的语句是()A、 Stu.bir.year=1988;B、 Stu.year=1988;C、 Stu. Birthday.year=1988;D、 Student. Birthday.year=1988;

考题 单选题若有定义语句:int year=2009,*p=year;,以下不能使用变量year中的值增至2010的语句是(  )。A *p+=1B (*p)++;C ++(*p);D *p++;

考题 单选题有以下定义和语句: structworkers {  intnum;  charname[20];  charc;  struct  {   intday;   intmonth;   intyear;  }s; }; structworkersw,*pw; pw=w; 能给w中year成员赋1980的语句是(  )。A *pw.year=1980;B w.year=1980;C pw-year=1980;D w.s.year=1980;

考题 单选题有定义语句: int *p[4]; 以下选项中与此语句等价的是(  )。A int p[4];B int **p;C int*(p[4]);D int(*p)[4];