填空题

下面的函数strcat(str1,str2)实现将字符串str2拼接到字符串str1后面的功能。请填空使之完整。 char*strcat(str1,str2) char*str1,*str2; { char*t=str1; while( 【16】 )str1++; while( 【17】 ); return(t);}

【参考答案】

【16】*str1 或 *str1!=’\0’ 或 *str1!=0 或 *str1!=NUL
<上一题 目录 下一题>
热门 试题

填空题
以下程序中用户由键盘输入一个文件名,然后输入一串字符(用#结束输入)存放到此文件中,形成文本文件,并将字符的个数写到文件的尾部。请填空。#include<stdio.h>main(){ FILE *fp;char ch,fname[32]; int count=0;printf(”Input the filename: );scanf( %s ,fname);if((fp=fopen( 【12】 , w+ ))==NULL){ printf( Can’t open file:%s n ,fname);exit(0);}printf( Enter data: n );while((ch=getchar())!=’#’){ fputc(ch,fp);count++;}fprintf( 【13】 , n%d n ,count);fclose(fp);}
填空题
函数void fun(float*sn,int n)的功能是:根据以下公式计算S,计算结果通过形参指针sn传回;n通过形参传入,n的值大于等于0。请补全程序。S=1-1 3+1 5-1 7+…+1 (2n+1)void fun(float*sn,int n){ float s=0.0,w,f=-1.0;int i=0;for(i=0;i<=n;i++){ f= 【14】 *f;w=f (2*i+1);s+=w;}【15】 =s;}
相关试题
  • 以下函数fun用于求两个整数a和b的最大公约...