#include<stdio.h>
#include<stdlib.h>
struct node
{
int num;
int L;
struct node *next;
};
typedef struct node LN;
typedef struct
{
int num1[100];
int L1;
}S;
void Creat1(S &p);
void Creat(LN *p);
void main()
{
S p;
LN *h;
p.L1=0;
int n;
Creat(h);
Creat1(p);
}
void Creat1(S &p)
{
int a;
printf("Input total number of list:");
scanf("%d",&a);
printf("\n");
system("CLS");
for(int i=0;i<a;i++)
{
printf("Input the %d one:",i+1);
scanf("%d",&p.num1[i]);
p.L1++;
}
system("CLS");
}
void Creat(LN *h)
{
int a;
LN *p;
LN *b;
printf("Input the number of the linklist:");
scanf("%d",&a);
h=(LN *)malloc(sizeof(LN));
h->next=NULL;
b=h;
for(int i=0;i<a;i++)
{
printf("Input the %d number ",i+1);
p=(LN *)malloc(sizeof(LN));
scanf("%d",p->num);
b->next=p;
b=p;
p->L++;
}
system("CLS");
p->next=NULL;
}
在Creat函数中创建了一个单链表,那么我要怎么返回主函数,因为我是void一个Creat的函数,急求,谢谢各位大神了。