c语言问题编译不通过,为什么?

来源:百度知道 编辑:UC知道 时间:2024/05/08 10:58:42
#include<stdio.h>
#define N 10
void main()
{

void qqqsort(int b[N],int p,int r);
int a[N],i,j;
printf("Please input N data:\n");
for(i=0;i<N;i++)
scanf("%d",&a[i]);
i=0;
j=N-1;
while(i<j)
qqqsort(a,i,N-1);
for(i=0;i<N;i++)
printf("%d ",&a[i]);
}

int partition(int c[N],int a,int b)
{
int i=a,j,x=c[i],temp;
for(j=a+2;j<=b;j++)
{
if(c[j]<x)
{
i++;
if(i!=j)
{
temp=c[i];
c[i]=c[j];
c[j]=temp;
}
}
temp=c[a];
c[a]=c[i];
c[i]=c[a];
return i;
}
void qqqsort(int b[N],int p,int r){
int q;
if(p<r)
{
q=partition(b,p,r);
qqqsort(b,p,q-1);
qqqsort(b,q+1,r);
}
}
这是我编的一个快速排序的程序,各位大侠帮我看看是哪错了?
是没有错误

//少一个括号
#include<stdio.h>
#define N 10
void main()
{
void qqqsort(int b[N],int p,int r);
int a[N],i,j;
printf("Please input N data:\n");
for(i=0;i<N;i++)
scanf("%d",&a[i]);
i=0;
j=N-1;
while(i<j)
qqqsort(a,i,N-1);
for(i=0;i<N;i++)
printf("%d ",&a[i]);
}

int partition(int c[N],int a,int b)
{
int i=a,j,x=c[i],temp;
for(j=a+2;j<=b;j++)
{
if(c[j]<x)
{
i++;
if(i!=j)
{
temp=c[i];
c[i]=c[j];
c[j]=temp;
}
}
}
temp=c[a];
c[a]=c[i];
c[i]=c[a];
return i;
}
void qqqsort(int b[N],int p,int r){
int q;
if(p<r)
{
q=partition(b,p,r);
qqqsort(b,p,q-1);
qqqsort(b,q+1,r);
}
}

函数的定义或声明都不能在另一函数里面,还有int partition(int c[N],int a,int b) 函数也需要事先声明才能调用``` 具体的函数内容我没看`` 这个你