请问各位高手这个程序错在哪了
#include <iostream>using namespace std;
typedef struct
{
int data[100];
int length;
}sqlist;
void creatsqlist(sqlist *s,int a[])
{
s=(sqlist *)malloc(sizeof(sqlist));
cout<<"请输入数据的个数:"<<endl;
int n;
cin>>n;
cout<<"请输入建表的数据:"<<endl;
for(int i=0;i<n;i++)
{
cin>>a[i];
s->data[i]=a[i];
}
s->length=n;
}
void dissqlist(sqlist *s)
{
if(s)
cout<<"输出数据为:"<<endl;
for(int i=0;i<s->length;i++)
cout<<s->data[i]<<endl;
}
void main()
{
sqlist *s;
int a[100];
s=(sqlist *)malloc(sizeof(sqlist));
creatsqlist(s,a);
dissqlist(s);
}