#include <stdio.h>
#include <stdlib.h>
struct cell {
int content;
struct cell* next;
};
typedef struct cell Cell;
void insert ( int, Cell* );
void printList ( Cell* );
int main (int argc, char** argv) {
Cell* first;
int x;
first = (Cell *) calloc(1, sizeof(Cell));
for ( x = 1 ; x <= 10 ; x++ ) {
insert( x, first );
}
printList( first );
return 0;
}
void insert ( int nContent, Cell* cell ) {
Cell *tmp, *ins;
ins = (Cell *) calloc(1, sizeof(Cell));
for (tmp = cell ; tmp != NULL ; tmp = tmp->next);
tmp = ins;
}
void printList ( Cell* cell ) {
Cell* tmp;
for ( tmp = cell ; tmp != NULL ; tmp = tmp->next ) {
printf("- %3d\n", tmp->content);
}
}