• 2021-04-14
    【单选题】有以下定义和语句 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).s.year=1980; B. w.year=1980; C. pw‐>year=1980; D. pw.s.year=1980;
  • (*pw).s.year=1980;

    举一反三

    内容

    • 0

      【填空题】如有以下定义和语句,则sizeof(a) = (),sizeof(b) = ()。 struct { int day; char month; int year;}a,*b;

    • 1

      已知学生记录描述为: struct student { int num; char name[20]; struct { int year; int month; int day; }birth; }; struct student s; 下列对 “ 生日”的正确赋值方式是( )

    • 2

      若有以下定义,则对变量student1中“生日”的正确赋值方式是( )。 struct student { int num; char name[20], sex; struct { int year, month, day; } birthday; } ; struct student student1;

    • 3

      9.若有以下定义,则对变量student1中“生日”的正确赋值方式是 struct student { int num; char name[20], sex; struct { int year, month, day; } birthday; } ; struct student student1;

    • 4

      程序:class Birthday{int year;int month;int day;public Birthday(int year,int month,int day){year = year; month = month; day = day;}public static void main(String[] args){Birthday birth = new Birthday(1980,10,22); System.out.println(year);}}程序运行后的输出是哪项? A: 1980 B: 10 C: 22 D: 0 E: 编译出错