Home > Back-end >  Please help to see this static linked list
Please help to see this static linked list

Time:10-09

# include "stdio.h"
# include "stdlib. H"
Typedef struct
{
The int data;
Int cur;
} the Node;

Typedef struct
{
The Node list [10].
Int the av;
} SLlist;

# include "staticlist. H"
Void PrintList (SLlist L, int n)
{
Int j, k;
K=L.l ist [0]. Cur;
for(j=1; j<=n; J++)
{
Printf (" % d ", L.l ist [k]. Data);
K=L.l ist [k]. Cur;
}
printf("\n");
}

The main ()
{
SLlist L;
Int a []=,2,3,4,5,6,7 {1};
Int n=sizeof (a)/sizeof (a [0]);
int i;
InitSLlist (& amp; L);
for(i=1; I<=n; I++)
InsertList (& amp; L, I, a [I - 1));
PrintList (L, n);
}

Void InitSLlist (SLlist * L)
{
int i;
for(i=1; I<10; I++)
(* L). The list [I]. Cur=I + 1;
(* L). The list [9]. Cur=0;
(* L). The av=1;
}

Staticlist. H
Void InsertList (SLlist * L, int, int) e
{
Int k, j, x;
K=(* L). The av;
(* L). The av=(* L). The list [k]. Cur.
(* L). The list [k]. data=https://bbs.csdn.net/topics/e;
J=(* L). The list [0]. Cur.
For (x=1; xJ=(* L). The list [j]. Cur.
(* L). The list [k]. Cur=(* L). The list [j]. Cur.
(* L). The list [j]. Journal of cur=k;
}
Vc 6.0 under the compile and link error, but prompt execution program has stopped work, this is how to return a responsibility?
  • Related