
九指针(二) 1,以下程序的功能是:通过指针操作,找出三个整数中的最小值并输出。 请填空。 #include "stdlib.h" main( {int ta.b,轮,m,x,,z a-kx:b-ky:cz: printf(输入3个整数,: scanf("sdsd".a,b,c) printf(d,dn”,,h,c): 队=和: if(体a>种)》— if (mun>ec): printf(输出最小整数:d小n”,u: 1 2,下面程序段的运行结果是 char s[80],*sp="HELLO!": sp=strepy (s,sp): s[0]-b: 陶ts(sp): 3.下面程序段的运行结果是 char str[]="abe\Odef\Oghi",*p=str: printf("%s",p+5): 4.下面程序的功能是将两个字符串s1和s2连接起来。请填空。 年include(stdio.h> main() [char sI[80].s2[80]: xets(s1):gets(s2) conj(s1.s2):
九 指针(二) 1.以下程序的功能是:通过指针操作,找出三个整数中的最小值并输出。 请填空。 #include "stdlib.h" main() {int *a,*b,*c,num,x,y,z; a=&x;b=&y;c=&z; printf("输入 3 个整数:"); scanf("%d%d%d",a,b,c); printf("%d,%d,%d\n",*a,*b,*c); num=*a; if(*a>*b)______; if(num>*c)______; printf("输出最小整数:%d\n",num); } 2.下面程序段的运行结果是________. char s[80],*sp="HELLO!"; sp=strcpy(s,sp); s[0]='h'; puts(sp); 3.下面程序段的运行结果是________. char str[]="abc\0def\0ghi",*p=str; printf("%s",p+5); 4.下面程序的功能是将两个字符串 s1 和 s2 连接起来。请填空。 #include main() {char s1[80],s2[80]; gets(s1); gets(s2); conj(s1,s2);

p陶ts(sI): conj(char *pl.char p2) [char p=pl: hile(o1)一 while(p2)(+pl-:pl++:p2++:) pl=0: 1 5.若有定义:inta0=2,4,6,8,10,12到,p:则*p*1)的值是,*a*5)的值是 6.若有以下定义:inta2][3)-2,4,6,8,10,12:则a[1][0]的值是 *(体(a+1)0)的值是 T,以下程序将数组a中的数据按逆序存放,请填空。 adefine M 8 main() [int a[M].i,j.t: far(i=0:ia:i+)scanf(d°,t+i): i0:j41: hi1e(i<》 / t=*(a+i): *()=: i+:j- 1 for (i=0:iM:1++)printf(%3d",*(a+1)) 1 8.若有定义:inta[3][5】,i,j:(且0<-i3,0-j5),则a数组中任一元素可用 五种形式引用。它们是 (1)a[i][] 2)◆(a[i]+)
puts(s1); } conj(char *p1,char *p2) {char *p=p1; while(*p1)______; while(*p2){*p1=______;p1++;p2++;} *p1='\0'; __________; } 5.若有定义:int a[]={2,4,6,8,10,12},*p=a;则*(p+1)的值是______. *(a+5)的值是 _________. 6.若有以下定义:int a[2][3]={2,4,6,8,10,12};则 a[1][0]的值是_____. *(*(a+1)+0))的值是________. 7.以下程序将数组 a 中的数据按逆序存放,请填空。 #define M 8 main() {int a[M],i,j,t; for(i=0;i<M;i++)scanf("%d",a+i); i=0;j=M-1; while(i<j) { t=*(a+i);________;*(_______)=t; i++;j--; } for(i=0;i<M;i++)printf("%3d",*(a+i)); } 8.若有定义:int a[3][5],i,j;(且 0<=i<3,0<=j<5),则 a 数组中任一元素可用 五种形式引用。它们是: (1)a[i][j] (2)*(a[i]+j)

3》*(体): (4)(体(aD)[] (5同*(+5+》 9,下面程序的运行结果是 main() [char *a]="Pascal","C language","dBase","Coble" char (ep)[] int j: a+3: for(j3:j》=0:j-)printf(wsn”,*p-)):
(3)*(*______); (4)(*(a+i))[j] (5)*(____+5*i+j) 9.下面程序的运行结果是_________. main() {char *a[]={"Pascal","C language","dBase","Coble"}; char (**p)[]; int j; p=a+3; for(j=3;j>=0;j--)printf("%s\n",*(p--)); }