Next | The Identity Function | 15 |
To do reasonable programming, you need dynamic memory allocation
For example, for linked lists:
node * insert_node (node **head, void*data) { node *newnode = malloc(sizeof(node));
if (newnode == 0) return 0;
newnode->data = data; newnode->next = *head; *head = newnode;
return newnode; }
The malloc here is essential
So are the *s
Next | Copyright © 2001 M. J. Dominus |