数据结构中,struct pro { int id; char name[20]; }; void fun(struct pro p[]) { ......;//函数体省略 }关于本程序段描述不正确的是()。
第1题:
设有定义:
struct person
{ int ID;char name[12];}p;
请将 scanf("%d", 【 1 2 】 ); 语句补充完整,使其能够为结构体变量 p 的成员 ID 正确读入数据。
第2题:
下列语句段中,正确的是( )。
A.struct{int x;float y;int a[2];unsigned b[3];char name[10];};
B.struct stu{unsigned a[3];unsigned b[4];}x;int*p=&x.a;
C.struct stu{int a;float x[4];}y={1,1.0};float data=y.x;
D.struct nd{int a,b;unsigned c[2]=5;};
第3题:
以下结构体类型说明和变量定义中正确的是
A)typedef struct
{int n; char c;} REC;
REC t1,t2;
B)struct REC;
{int n; char c;};
REC t1,t2;
C)typedef struct REC ;
{int n=0; char c='A';} t1,t2
D)struct
{int n;char c;}REC;
REC t1,t2;
第4题:
看这段程序,可是执行。#include <stdio.h>int main(int argc, char *argv[]){ struct info { char name[33]; int age; }; struct info aa[3]={"meng",20,"juan",29,"an",59}; struct info *p=aa; for(int i=0;i<3;i++,p++) printf("%-6s %d\n",p->name,p->age);}将其改成这样:#include <stdio.h>int main(int argc, char *argv[]){ struct info { char name[33]; int age; }; struct info aa[3]={"meng",20,"juan",29,"an",59}; //struct info *p=aa; for(int i=0;i<3;i++,aa++) printf("%-6s %d\n",aa->name,aa->age);}为什么就执行不了呢
第5题:
以下结构体类型说明和变量定义中正确的是( )。
A.typedef struct
B.struct REC; {int n;char c;}REC; {int n;char c;}; REC t1,t2; REC t1,t2;
C.typedef struct REC;
D.struct {int n=0;char c='A';}t1,t2; {int n;char c;}REC; REC t1,t2;
第6题:
若有下面说明和定义:struct test{ int m1;char m2;float m3;union uu(char u1[5];int u2[2];)ua;}myaa; 则sizeof(struct test)的值是( )。A)20 B)16C)14 D)9
第7题:
● 给定 C 语言的数据结构
struct T {
int w;
union T { char c; int i; double d; } U;
};
假设 char 类型变量的存储区大小是 1 字节,int 类型变量的存储区大小是 4 字节,double类型变量的存储区大小是 8 字节,则在不考虑字对齐方式的情况下,为存储一个 struct T类型变量所需要的存储区域至少应为 (15) 字节。
(15)
A. 4
B. 8
C. 12
D. 17
第8题:
( 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;
第9题:
若有下面的说明和定义
struct test
{ int ml; char m2; float m3;
union uu {char ul[5]; int u2[2];} ua;
} myaa;
则sizeof(struct test )的值是
A.12
B.16
C.14
D.9
第10题:
下列对结构及其变量定义错误的是( )。
A.struct My Struct
B.struct MyStruct{ {int num; int num;char ch; char ch;} }My;
C.strut
D.struct{ {int num; int num;char ch; char ch;}My; };