This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
haas:fall2018:data:projects:sln1 [2018/09/04 13:31] – [Linking our node to another node] wedge | haas:fall2018:data:projects:sln1 [2018/09/06 14:20] (current) – [node library] wedge | ||
---|---|---|---|
Line 220: | Line 220: | ||
Since we need to keep a placeholder on our allocated memory, **first** is intended to be a more or less immovable aspect of our list (it is our link to everything- we don't want to adjust it unless we absolutely need to). | Since we need to keep a placeholder on our allocated memory, **first** is intended to be a more or less immovable aspect of our list (it is our link to everything- we don't want to adjust it unless we absolutely need to). | ||
- | You may be noticing the potential for some very long code about to happen (what if we wanted to add a third node... those there' | + | You may be noticing the potential for some very long code about to happen (what if we wanted to add a third node... those there' |
Here is that same node construction logic, redone using an additional **tmp** node pointer, and also adding in a third node (containing the value 8): | Here is that same node construction logic, redone using an additional **tmp** node pointer, and also adding in a third node (containing the value 8): | ||
< | < | ||
- | Node *first, *tmp = NULL; | + | Node *first |
first = (Node *) malloc (sizeof(Node)); | first = (Node *) malloc (sizeof(Node)); | ||
Line 446: | Line 446: | ||
This is your API for the node library. In order to use the node library three things need to happen: | This is your API for the node library. In order to use the node library three things need to happen: | ||
- | * you must **#include " | + | * you must **#include " |
* you must link against **lib/ | * you must link against **lib/ | ||
* you must call the functions providing the appropriate arguments and handling the return values | * you must call the functions providing the appropriate arguments and handling the return values |