Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. ListItem *LinkedListNew(char *data)
  2. {
  3. // allocate memory for the list
  4. ListItem *newlist = malloc(sizeof (ListItem));
  5. if (newlist == NULL) {
  6. return NULL;
  7. }
  8. // empty list, set data field to contain string
  9. // pointers to other nodes to be NULL
  10. newlist -> data = data;
  11. newlist -> previousItem = NULL;
  12. newlist -> nextItem = NULL;
  13.  
  14. return newlist;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement