定义结构体类型时可以给成员变量设定初值,例如下列定义是合法的。 struct data { int x,y=10;};

定义结构体类型时可以给成员变量设定初值,例如下列定义是合法的。 struct data { int x,y=10;};


参考答案和解析
可以

相关考题:

设有以下语句typedef struct TT{char c,int a[4];} CIN;则下面叙述中正确的是A) 可以用 TT 定义结构体变量B)TT 是 struct 类型的变量C) 可以用 CIN 定义结构体变量D)CIN 是 struct TT 类型的变量

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

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

下面结构体的定义语句中,错误的是A)struct ord {int x;int y;int z;}; struct ord a;B)struct ord {int x;int y;int z;} struct ord a;C)struct ord {int x;int y;int z;} a;D)struct {int x;int y;int z;} a;

设有以下语句 typedef struct TT {char c; int a[4];}CIN; 则下面叙述中正确的是______。A.可以用TT定义结构体变量B.TT是struct类型的变量C.可以用CIN定义结构体变量D.CIN是struct TT类型的变量

已知有结构体: struct sk { int a; float b; }data,*p; 若有p=data,则对data的成员a的正确引用是( )。A.struct是结构体类型的关键字B.st是结构体类型名C.x、y、z都是结构体成员名D.struct str是结构体类型名

下面结构体的定义语句中,错误的是( )。A.struct ord{int x;int y;int z;};struct ord a;B.struct ord{int x;int y;int z;};ord a;C.struct ord{int x;int y;int z;}a;D.struct{int x;int y;int z;}a;

以下定义的结构体类型拟包含两个成员,其中成员变量info用来存入整形数据;成员变量link是指向自身结构体的指针,请将定义补充完整。struct node{ int info;【19】link;};

下面结构体的定义语句中,错误的是( )。 A.struct ord{int x;int Y;int Z;};struet ord a;SXB 下面结构体的定义语句中,错误的是( )。A.struct ord{int x;int Y;int Z;};struet ord a;B.struct ord{int x;int y;int Z;}struct ord a;C.struct ord{int X;int Y;int Z;}a;D.struct{int X;int y;int Z;}a;

设有以下语句: typedef street S { int g; char h;} T;则下面叙述中正确的是( )。A.可用S定义结构体变量B.可以用T定义结构体变量C.S是struct类型的变量D.T是struct S类型的变量

设有以下语句: typedef struct S { int g; char h; } T; 则下面叙述中正确的是( )。A.可以用S定义结构体变量B.可以用T定义结构体变量C.S是struct类型的变量D.T是stnictS类型的变量

若有以下结构体定义,则______是正确的引用或定义。 struct example { int x; int y; }v1;A.example.x=10B.example v2.x=10C.struct v2;v2.x=10D.struct example v2={10};

若有以下结构体定义,则是正确的引用或定义。struct example{ int x; int y;}v1;A.example.x=10B.examplev2.x=10C.struct v2;v2.x=10D.struct example v2={10};

下列说法错误的是( )。A.下列结构体定义时,占据了5个字节的空间 struct student {int num; int age; char sex; }B.结构体的成员名可以与程序中的变量名相同C.对结构体中的成员可以单独使用,它的作用相当于普通变量D.结构体可以嵌套定义

若有以下结构体定义,则______是正确的引用或定义。 struct example { int x; int y; }v1;A.example.x=10B.example v2.x=10C.example.x=10D.struct example v2={10};

若定义下列结构体,结构体变量p的出生年份赋值正确的语句是( )。 struct st { int x; int y; int z; } struct worker { char name[20]; char sex; struct st birth; }p;A.x=1987B.birth.x=1987;C.p.birth.x=1987;D.p.x=1987;

设有以下语句typedef struct S{ int g; char h; } T;则下面叙述中正确的是( )A.可用S定义结构体变量B.可以用T定义结构体变量C.S是struct类型的变量D.T是struct S类型的变量

设定义下列结构体,结构体变量p的出生年份赋值正确的语句是( )。Struct st{ int x;inty;int z;}Struct worker{ char name[20];char sex;struct st birth;}p;A.x=1987B.birth.x=1987;C.p.birth.x=1987;D.p.x=1987;

下面结构体的定义语句中,错误的是A.struct ord{int x;int y;int z;};struet ord a;B.atruet ord{int x;int y;int z;}struct ord a;C.struet ord{int x;int y;int z;}a;D.struct{int x;int y;int z;)a;

设定义下列结构体,结构体变量p的出生年份赋值正确的语句是( )。 stmct st { int x; int y; int z; } struct worker { char name[20]; char sex; struct st birth; }p;A.x=1987B.birth.x=1987;C.p.birth.x=1987;D.p.x=1987;

下面结构体的定义语句中,错误的是( )。A.struct ord{int x;int Y;int z;}struct ord a;B.struct ord{int x;im Y;im z;};struct ord a;C.struct ord{int x;int Y;int Z;}a;D.struct{int x;int Y;int z;}a;

若有以下语句:typedef struct S{int 9;char h;}T;以下叙述中正确的是( )。A.可用s定义结构体变量B.可用T定义结构体变量C.S是struct类型的变量D.T是struct S类型的变量

设有以下语句:typedef struct TY{char C;int a{4 1;}CIN;则下面叙述中正确的是( )。A.CIN是struct Tr类型的变量B.TT是struct类型的变量C.可以用,lr定义结构体变量D.可以用CIN定义结构体变量

设定义下列结构体,结构体变量p的出生年份赋值正确的语句是( )。 struct st { int x; int y; int z; } struct worker { char name[20]; char sex; struct st birth; }p;A.x=1987B.birth.x=1987;C.p.birth.x=1987;D.p.x=1987;

下面正确的结构体定义格式是()A、struct结构体名{类型成员变量1;类型成员变量2;….类型成员变量n;};B、struct结构体名{类型成员变量1;类型成员变量2;….类型成员变量n;}C、struct{类型成员变量1;类型成员变量2;….类型成员变量n;}结构体名;D、struct{类型成员变量1;类型成员变量2;….类型成员变量n;}结构体名

单选题下面结构体的定义语句中,错误的是(  )。Astruct ord{int x;int y;int z;};struct ord a;Bstruct ord{int x;int y;int z;}struct ord a;Cstruct ord{int x;int y;int z;}a;Dstruct {int x;int y;int z;}a;

单选题设有以下语句typedef struct TT{char c;int a[4]} CIN;则下面叙述中正确的是( )。ACIN是structTT类型的变量BTT是struct类型的变量C可以用TT定义结构体变量D可以用CIN定义结构体变量

单选题若有以下程序:typedef struct S{int g;char h;}T;以下叙述中正确的是(  )。A可用S定义结构体变量B可用T定义结构体变量CS是struct类型的变量DT是struct S类型的变量