[ create a new paste ] login | about

Link: http://codepad.org/UB530uSP    [ raw code | output | fork ]

C, pasted on Dec 7:
#include <stdio.h>

typedef struct Node
{
   int coeff, power;
   void* next;
} Node;

void append(int coeff, int power, Node *head)
{
   Node *temp;
   Node *new;
   new = (Node*) malloc(sizeof(Node));
   temp = (Node*) malloc(sizeof(Node));

   new->coeff = coeff;
   new->power = power;
   new->next = NULL;

   if (!head)
      head = new;
   else
   {
      temp = head;
      while(temp->next)
         temp = temp->next;
      temp->next = new;
   }
}

int main()
{
   Node *listhead = NULL;
   append(32,40,listhead);
   prinf("%d, %d\n", listhead->power, listhead->coeff);

}


Output:
1
2
In function `main':
undefined reference to `prinf'


Create a new paste based on this one


Comments: