#include <stdio.h>
#include <stdlib.h>

typedef struct _node {
  int datum;
  struct _node *next;
} node;

int main(int argc, char** argv) {
  node *head = (node*)malloc(sizeof(node)); // not checking return!
  node *cur = head;

  head->datum = -1;
  for (int i = 0; i < 5; i++) {
    cur->next = (node*)malloc(sizeof(node)); // not checking return!
    cur = cur->next;
    cur->datum = i;
  }
  cur->next = NULL;

  cur = head;
  while (cur) {
    printf("%d\n", cur->datum);
    cur = cur->next;
  }

  free(head);
}