Like this:
#define MAXLIST 100
int first, next [MAXLIST];
/* let the list be: #0 ---> #2 ---> #1 */
first= 0;
next[0]= 2;
next[2]= 1;
next[1]= -1; /* means end of list */
Note: you should track which elements are unused,
in the beginning every elements are unused:
int first_unused= 0;
for (i= 0; i<MAXLIST; ++i) next[i]= i+1;
next[MAXLIST-1]= -1; /* means end of list */
Copyright © 2026 eLLeNow.com All Rights Reserved.