c:\users\lenovo\desktop\nn.cpp(42) : error C2059: syntax error : ']' 问题出现那里???

#include <iostream.h>
#include<stdio.h>
#include <stdlib.h>
#include <time.h>//用于做种子
typedef int KeyType;
typedef char InfoType[10];
typedef struct
{
KeyType key;
InfoType data;
} RecType;
void main()
{
srand(time(NULL)); //使用这个就可以每次不同
int n;
int count=0;
int array[1000];
printf("输入数组元素个数:");
scanf("%d",&n); //输入数组元素个数

for(int i=0;i<n;i++)
{

array[i]=rand()%100;
printf("%d\n",array[i]); //显示生成的随机数组
}
printf("QuickSort Start!\n");
void QuickSort(RecType array[],int s,int t);
for(int k=0;k<n;k++)
printf("%d ",array[k]);
printf("\n");
printf("比较次数:%d\n",count);
}

void QuickSort(RecType array[],int s,int t)
{
int i=s,j=t;
RecType tmp;
int count=0;
if(s<t)
{
tmp=array[];
while(i!=j)
{
while(j>i && array[j].key>=tmp.key)
j--;
array[i]=array[j];
while(i<j && array[i].key<=tmp.key)
i++;
array[j]=array[i];
}
array[i]=tmp;
QuickSort(array,s,i-1);
QuickSort(array,i+1,t);
}
count++;
}

第1个回答  2013-09-19
tmp=array[];

你的这一句下标里边怎么没有值呢?追问

我明白了,谢谢

本回答被提问者采纳
第2个回答  2013-09-19
tmp=array[];//显示是这一句,你的类型不对啊,结构和结构数组