填空题

已有定义:double *p;,请写出完整的语句,利用malloc函数使p指向一个双精度型的动态存储单元 【18】 。

【参考答案】

p=(double *)malloc(sizeof(double))
<上一题 目录 下一题>
热门 试题

填空题
下面程序的功能是:将字符数组a中下标值为偶数的元素从小到大排列,其他元素不变。请填空。 #include<stdio.h> #include<string.h> main() char a[]= clanguage ,t; int i,j,k; k=strlen(a); for(i=0;i<=k-2;i+=2) for(j=i+2;j<=k;j+=2;) if( 【20】 ) t=a[i];a[i]=a[j];a[j]=t; puts(a); printf( n );
填空题
下面程序的功能是从键盘输入一行字符,统计有多少个单词,单词间用空格分隔。补充所缺语句。 #include<stdio.h> main() chars s[80],c1,c2=’ ’; int i=0,num=0; gets(s); while(s[i]!=’ 0’) c1=s[i]; if(i==0)c2=’ ’; else c2=s[i-1]; if( 【16】 )num++; i++; printf( There are%d words, n ,num);
相关试题
  • 以下程序的输出结果是 【17】 。 void...
  • 下列程序输出的结果是 【19】 。 fun...