编一函数int fun(int s[ ]),其功能是返回字符串s的长度
来源:百度知道 编辑:UC知道 时间:2024/09/24 05:28:51
考试题,急要,谢谢!!
改正:字符串一般为:char s[]而非int s[],函数原型为:int fun(int s[])
编译环境:VC6.0
#include <stdio.h>
int fun(char s[]){
if(!s[0]) return -1;
int i=0;
while(s[i]) ++i;
return i;
}
int main(){
char ar[] = "ascd";
printf("LEN:%d\n",fun(ar));
return 0;
}
wangsl1978:回答问题不负责任,死循环你都没看出来?
int fun(int s[ ])
{
int i=0,k=0;
while(s[i]!='\0')
k++;
return k;
}
函数void fun(int x,int k,int *p)
请编写一个函数void fun(int a[],int n, int *max,int *d)
5.请编写函数void fun(int x,int pp[],int *n)
编写函数void fun(char s[],int c)
编写一个函数void fun(char *tt,int pp[6])
14.请编写一个函数int fun(int x),它的功能是:
请编写一个函数 void fun ( int tt[3][4], int pp[4] )
编函数void fun(char *tt,int pp[ ]),统计tt在字符串中a到z字母出现的次数由pp数组传回main 函数
编写函数int fun(int a[],int n),其功能是求一维数组中前n个数的最大值,最大值作为函数返回值。
编写函数void fun(int *a,int *n,int y)它的功能是把y插入到a数组中使其次序不变