Typedef's and nodes
<p>This code is supposed to build a simple linked list containing integers from 0 to 20. I keep getting the error: <code>unknown type name 'node'</code> when I compile my code for what seems every instance of node in the program. I'm not sure if I have to define them or there is a bigger flaw in the code.</p>

<pre><code>#include&lt;stdio.h&gt;
#include&lt;stdlib.h&gt;

int main()  {
    int i;
    struct node *first=NULL;
    for(i=1;i&lt;=20;i++)
        first=insertrear(first,i);
    dispnodes(first);
    sum(first);

return 0;
}
typedef struct node {
    int data;
    struct node *link;
};

 node* getnode(node *temp,int i) {
    temp=(node*)malloc(sizeof(node));
    temp-&gt;data=i;
    temp-&gt;link=NULL;
    return temp;
}
node* insertrear(node *first,int a) {
    node *temp=NULL,*i;
    temp= getnode(temp,a);
    if(first==NULL) {
        first=temp;
        return first;
    }

    for(i=first;i-&gt;link!=NULL;i=i-&gt;link);
        i-&gt;link=temp;
        return first;
}

void dispnodes(node *first) {
    int j;
    if(first==NULL) {
        printf("\nlist empty");
        return;
    }
    node *i;
    for(i=first,j=0;i!=NULL;j++,i=i-&gt;link)
        printf("\nNode #%d contains %d  ",j,i-&gt;data);
}

void sum(node *first)   {
    node *i;
    int total=0;
    for(i=first;i!=NULL;i=i-&gt;link)
        total+=i-&gt;data;
    printf("\nThe sum total of all nodes in this list is %d",total);
}
</code></pre>