相关题目
若有以下程序段:
struct student
{
int num ;
int age ;
}
struct student stu[3]={{101,20},{102,19},{103,20}};
main( )
{ struct student *p;
p=stu;
…
}
则以下引用形式不合法的是( )。
若有以下说明和语句, 则在scanf 函数调用语句中对结构体变量成员的不正确引用方式是( )。
struct pupil
{ char name[20];
int age;
int sex;
}pup[5],*p;
p = pup;
以下程序的输出结果是( )。
struct stu
{ int x;
int *y;
} *p;
int dt[ 4 ]={ 10 , 20 , 30 , 40 } ;
struct stu a[ 4 ]={ 50 , &dt [ 0] , 60 , &dt [1] ,70 , &dt [ 2] , 80 , &dt [ 3 ]};
main ( )
{ p = a ;
printf (“%d”,++p->x ) ;
printf (“%d”,(++p)->x) ;
printf (“%d\n”,++(*p->y)) ;
}
若有以下说明和语句, 则下面引用形式中不正确的是( )。
struct student
{ int age ;
int num;
} ;
struct student stu [ 3 ] = {{1001 , 20 } , { 1002 , 19 } , { 1003 , 21 } } ;
struct student *p ;
p = stu ;
以下对结构体变量stul 中成员age 的非法引用是( )。
struct student
{ int age ;
int num;
}stul,*p;
P=&stul;
设有以下说明和定义语句, 则下面表达式中值为3 的是( )。
struct s
{ int i1 ;
struct s *12 ;
} ;
static struct s a [3]={1,&a[1],2,&a[2],3,&a[0]},*ptr;
ptr=&a[1];
以下程序的功能是: 读入一行字符(如: a , … y , z ) , 按输入时的逆序建立一个链接式的结点序列, 即先输入的位于链表尾 , 然后再按输入的相反顺序输出, 并释放全部结点。 请选择正确的内容填入( ) 中。
# include
# define getnode(type) ( type * ) malloc(sizeof(type))
main( )
{
struct node
{
char info ;
struct node *link ;
}*top ,*p ;
char c;
top = NULL ;
while ( ( c = getchar ( ) )!= ‘\n’ )
{ p = getnode ( struct node ) ;
p ->info=c ;
p ->link = top ;
top =p ; }
while ( top )
{
( ) ;
top = top ->link ;
putchar ( p ->info ) ;
free ( p ) ; }
}
若要利用下面的程序片段使指针变量p 指向一个存储整型变量的存储单元, 则【】中应填入的内容是( )。
int *p;
p=【 】 malloc ( sizeof ( int ) );
若已建立下面的链表结构, 指针p 、 q 分别指向图中所示结点, 则不能将q 所指的结点插入到链表末尾的一组语句是( )。
当说明一个共用体变量时系统分配给它的内存是( )。
