Lint gives me a warning at the malloc in that first loop:
warning: improper pointer/integer combination: op "="
Here's the program...it has quite a few runtime bugs, but the main compiler problem is at that malloc line. Please help!
#include <assert.h>
#include <stdio.h>
typedef struct node *node_ref;
struct node {
char *word;
node_ref link;
};
int main (int argc, char **argv) {
node_ref head = NULL;
node_ref p;
int count;
for (count = 0; count < 5; ++count) {
node_ref node = malloc (sizeof (struct node));
assert (node != NULL);
node->word = argv[count];
node->link = head;
head = node;
}
for (p = head; p->link != NULL; p = p->link) {
printf ("%p->{%s, %p}\n", p, p->word, p->link);
}
return 0;
}