标题:怎么了?
取消只看楼主
跑虎号
Rank: 1
等 级:新手上路
帖 子:2
专家分:5
注 册:2009-12-23
结帖率:100%
已结贴  问题点数:20 回复次数:0 
怎么了?
#include<stdio.h>
int search(int list,int n,int x);
int main(void)
{
    int n,x,i,index,a[10],b,list;
   printf("Input n:");
   scanf("%d",&n);
   printf("Input %d integers:",n);
   for(i=0;i<n;i++)
       scanf("%d",&a[i]);
   printf("Input x:");
   scanf("%d",&x);
   b=search(list,n,x);
   
   if(b!=-1)
       printf("index=%d",index);
   if(b=-1)
       printf("NO FOUND");
   return 0;

}
int search(int list,int n,int x)
{  
    int i,a[10],index;
    for(i=0;i<n;i++)
        if(x==a[i])
            index=i;
        else
            index=-1;
        return index;
}
搜索更多相关主题的帖子: include search return 
2009-12-23 09:04



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-294113-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.130445 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved