二、填空题
13.8 以下程序的输出结果是_____。
#define PR(ar) printf("ar=%d ",ar)
main()
{ int j,a[]={1,3,5,7,9,11,13,15},*p=a+5;
for(j=3; j; j--)
tch(j)
{ case 1:
case 2:PR(*p++); break;
case 3:PR(*(--p));
}
}
答案:ar=9 ar=9 ar=11
13.9 下面程序调用getone函数开辟一个动态存储单元,调用assone函数把数据输入此动态存储单元,
调用outone函数输出此动态存储单元中的数据。请填空。
#include "stdio.h"
getone(int **s)
{ *s=(____)malloc(sizeof(int)); }
assone(int *s)
{ scanf("%d",_____); }
outone (int *b)
{ printf("%d\\n",_____); }
main()
{ int *p;
getone(&p); assone(p); outone(p);
}
答案:int *s *b