32、请编写函数fun,函数的功能是查找x在s所指数组中下标的位置作为函数值返回,若x不存在,则返回-1。
注意:部分源程序存在PROG1.C中,请勿改动主函数main和其它函数中的任何内容,仅在函数fun的花括号中填入你编写的若干语句。
#include #include #define N 15
void
int fun( int *s, int x)
{ }
main()
{ int a[N]={ 29,13,5,22,10,9,3,18,22,25,14,15,2,7,27},i,x,index;
printf("a数组中的数据 :\n");
for(i=0; i index=fun( a, x );
printf("index=%d\n",index);
}
| 广告合作:400-664-0084 全国热线:400-664-0084 Copyright 2010 - 2017 www.my8848.com 珠峰网 粤ICP备15066211号 珠峰网 版权所有 All Rights Reserved
|