结构体问题
#include <iostream>
using namespace std;
const int MAXSIZE = 20;
typedef struct{
int r[MAXSIZE+1];
int length;
}sqList;
void InsertPass(sqList &L,int i){
int j;
L.r[0]=L.r[i];
for(j=i-1;L.r[0]<L.r[j];j--){
L.r[j+1]=L.r[j];
}
L.r[j+1]=L.r[0];
}
int main(){
sqList L;
L.r[MAXSIZE+1] = {1,3,4,5};
L.length=3;
InsertPass(L,2);
system("pause");
return 0;
}
提示 L.r[MAXSIZE+1] = {1,3,4,5}; 出错,偶不明白!!