Guest User

Untitled

a guest
Aug 30th, 2016
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. struct node_int {
  2. void *data;
  3. node next;
  4. } node_int;
  5.  
  6. /*
  7. * 'Constructor' for node
  8. */
  9. void init_node(node *n, void *o)
  10. {
  11. n = (node *)malloc(sizeof(struct node_int));
  12. (*n)->data = 0;
  13. (*n)->next = NULL;
  14. }
  15. /*
  16. * Getter for data
  17. * Return data field
  18. */
  19. void *get_data(node n)
  20. {
  21. return (n->data);
  22. }
  23.  
  24. /*
  25. * Getter for next
  26. * Return next field
  27. */
  28. node get_next(node n)
  29. {
  30. return (n->next);
  31. }
  32.  
  33. /*
  34. * Setter for data
  35. * Param o value to be placed into the node's data field
  36. */
  37. void set_data(node n,void *o)
  38. {
  39. n->data = o;
  40. }
  41.  
  42. /*
  43. * Setter for next
  44. * Param x value to be placed into the node's next field
  45. */
  46. void set_next(node n, node x)
  47. {
  48. n->next = n;
  49. }
Add Comment
Please, Sign In to add comment