燕子加油!!!!!!
(1) 以下程序运行的结果是_______
#include”stdio.h”
main()
{ struct date
{ int year , month , day ;
} today ;
printf(“%d/n”,sizeof(struct date));
}
A .6 B.8 C.10 D.12
(2) 以下程序输出结果是_______ 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); //语句1 printf(“%d,” , (++p)->x ); //语句2 printf(“%d/n” , ++(*p->y) ); //语句3 } A.10 , 20 , 20 B.50 , 60 , 21 C.51 , 60 , 21 D 60 , 70 , 31
1. 设有以下语句: struct st { int n ; struct st *next; } ; static struct st a[3]={ 5 , &a[1] , 7 , &a[2] , 9 ,’/0’} , *p ; p=&a[0]; 则以下表达式的值为6的是________ A. p++ ->n B. p->n++ C. (*p) . n++ D. ++p ->n 2. 设有以下语句,则下面表达式中的值为3的是_______ struct s { int a1 ; struct s *a2 ; } ; static struct s a[3]={1 , &a[1] , 2 , &a[2] , 3 ,&a[0] } , * ptr ; ptr=&a[1] ; A. ptr -> a1++ B. ptr++ ->a1 C. *ptr -> a1 D. ++ptr ->a1
3. 若有以下语句,则下面表达式的值为1002的是______ struct student { int age ; int num ; } ; struct student stu[3]={{1001,20} , {1002,19} , {1003,21}} ; struct student *p ; p=stu ; A. (p++) -> num B. (p++)->age C. (*p) . num D. (*++) . age 4. 若有以下说明和语句: struct student { int age ; int num ; } std , *p ; p=&std ; 则以下对结构体变量std 中成员age 的引用方式不正确的是_______ A. std . age B. p -> age C. (*p) . age D. *p . age
(3) 若已建立下面的链表结构,指针p ,q分别指向图中所示结点,则不能将q所指的结点插入到链表末尾的一组语句是_________
A. q->next=NULL ; p=p->next ; p->next=q ;
B. p=p->next ; q-> next=p->next ; p->next=q ;
C. p=p->next ; q->next=p ; p->next=q ;
D. p=(*p) . next ; (*q) . next=(*p) . next ; (*p) . next=q;
解析:本题就是前面提到的链表的插入及删除类问题。重点理解结点的链入和删除顺序。
既指针移动的先后顺序。做这种处理时要慎重,谨防结点丢失。本题答案是C 。
(4)下面程序实现的功能是在已定义的的考生链表中删除指定考生号的结点。请按照程序功能填空。
Struct student *delete ( head , num ) ;
Struct student *head ;
Long num ;
{ struct student *p1 , *p2;
if ( head==NULL )
{ printf (“/nlist NULL ! /n”) ;
goto end ;
}
p2=head ;
while ((num != p2 -> num )&&( _________[1]_________ ) )
{ p1=p2 ; p2= p2 ->next ; }
if ( num== p2 ->num )
{
if ( p2==head ) head=p2 ->next ;
else ________[2]___________ ;
printf (“delete : % ld/n” , num );
n=n – 1;
}
else printf ( “%ld not found ! /n “ , num ) ;
end :
return (head );
}
已知下列共用体定义: union u_type { int I ; char ch ; } temp ; 现在执行“temp . I=266 ”, temp . ch 的值为 () A. 266 B. 256 C. 10 D. 1