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

typedef struct List {
  int head;
  struct List* tail;
} list;

list* upto (int n, list* p) {
  list* q;
  if (n > 0) {
    q = (list *) malloc(sizeof(list));
    q->head = n-1;
    q->tail = p;
    return upto(n-1, q);
  } else {
    return p;
  }
}

int length (list* p) {
  int i = 0;
  while (p) {
    i++;
    p = p->tail;
  }
  return i;
}

void count_pos(list* p, int* k) {
  int i = 0;
  while (p) {
    if (p->head > 0)
      i++;
    p = p->tail;
  }
  *k = i;
}

list* init_list() {
  list* q0 = upto (10, NULL);
  return q0;
}

int main () {
  int k = 0;
  int* w = &k;
  list* p0 = init_list();
  count_pos(p0, w);
  printf ("%d\n", k);
  return 0;
}
