新手求教,non portable pointer conversion in function main
代码如下#include <stdio.h>
#include <math.h>
main()
{
int bubblesort(int x[],int n);
int search(int x[],int k,int n);
int i,a[101],c;
for(i=1;i<=100;i++)
a[i]=abs(rand())%1000;
bubblesort(a[101],101);
c=search(a[101],250,101);
printf("%d",c);
}
int bubblesort(int x[],int n);
{
int i,j,flag,swap;
int swap;
flag=1;
for(i=0;i<n-1&&flag==1;i++)
{flag=0;
for(j=0;j<n-1;j++)
if(x[j]>x[j+1])
{flag=1;
swap=x[j];x[j]=x[j+1];x[j+1]=swap;
}
if(flag==0)return;
}
}
int search(int x[],int k,int n)
{int low,high,mid;
low=0;
high=n-1;
while(low<=high)
{mid=(low+high)/2;
if(x[mid]==k)
{printf("searching success");
return(mid);
}
else if(s[mid]<k)
low=mid+1;
else
high=mid-1;
}
printf("searching failed");
return(-1);
}
一段冒泡法排序和二分查找的程序
ctrl+F9之后提示non portable pointer conversion in function main
我语法学的不好~~各位大神快来帮我
~谢谢!!
[[it] 本帖最后由 acmilan2222 于 2009-7-25 22:33 编辑 [/it]]