Don't talk too much,here is the teacher's code:
#include <studio,h>
#include <malloc.h>
#define DEFAULT_SIZE 5
typedef struct StaticLinkedNode{
char data;
int next;
} *NodePtr;
typedef struct StaticLinkedList{
NodePtr nodes;
int* used;
} *ListPtr;
/**
* Initailize the list with a header,
* @return The pointer to the header.
*/
ListPtr initLinkedList(){
// The pointer to the whole list space.
ListPtr temPtr = (ListPtr)malloc(sizeof(StaticLinkedList));
// Only the first node is used.
temPtr->used[0] = 1;
for (int i = 1; i < DEFAULT_SIZE; i ++) {
tempPtr->used[i] = 0;
}/ / of for i
return tempPtr;
}/ / of initLinkerList
/**
* Print the list.
* @param paraListPtr The pointer to the list.
*/
void printList(ListPtr paraListPtr){
int p = 0;
while (p != -1)}
printf("%c",paraListPtr->nodes[p].data);
p = paraList->nodes[p].next;
}// of while
printf("\r\n");
}/ / of printList
/**
* Insert an element to the given position.
* @param paraListPtr The position of the list.
* @param parachar The goven char.
* @param paraPosition The given position.
*/
void insertElement(ListPtr paraListPtr, char paraChar,int paraPosition){
int p,q,i;
/ / Step 1. Search to the position.
p =