Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct node_int {
- void *data;
- node next;
- } node_int;
- /*
- * 'Constructor' for node
- */
- void init_node(node *n, void *o)
- {
- n = (node *)malloc(sizeof(struct node_int));
- (*n)->data = 0;
- (*n)->next = NULL;
- }
- /*
- * Getter for data
- * Return data field
- */
- void *get_data(node n)
- {
- return (n->data);
- }
- /*
- * Getter for next
- * Return next field
- */
- node get_next(node n)
- {
- return (n->next);
- }
- /*
- * Setter for data
- * Param o value to be placed into the node's data field
- */
- void set_data(node n,void *o)
- {
- n->data = o;
- }
- /*
- * Setter for next
- * Param x value to be placed into the node's next field
- */
- void set_next(node n, node x)
- {
- n->next = n;
- }
Add Comment
Please, Sign In to add comment