User Tools

Site Tools


haas:fall2018:data:projects:sln1

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
haas:fall2018:data:projects:sln1 [2018/09/04 13:31] – [Linking our node to another node] wedgehaas: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's would become there -> there, and so on). But there's a way to keep it simple (but ambiguous, at least without an updated diagram)... and that is to just use another variable, whose job is to be more of a temporary placeholder. We shall call it **tmp**.+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's would become right -> right, and so on). But there's a way to keep it simple (but ambiguous, at least without an updated diagram)... and that is to just use another variable, whose job is to be more of a temporary placeholder. We shall call it **tmp**.
  
 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):
  
 <code> <code>
-Node *first, *tmp = NULL;+Node *first = NULL, *tmp = NULL;
  
 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 "node.h"** (generally already done you in this project)+  * you must **#include "node.h"** (generally already done for you in this project)
   * you must link against **lib/libnode.a** (the Makefiles will take care of this for you)   * you must link against **lib/libnode.a** (the Makefiles will take care of this for you)
   * 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
haas/fall2018/data/projects/sln1.1536067917.txt.gz · Last modified: 2018/09/04 13:31 by wedge