Created
February 15, 2013 16:24
-
-
Save johnsogg/4961478 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
struct node { | |
int value; | |
node* next; | |
}; | |
int add_to_all(node** top_ref, int num) { | |
node* cursor = *top_ref; | |
do { | |
cursor->value = cursor->value + num; | |
cout << cursor->value << endl; | |
cursor = cursor->next; | |
} while (cursor != NULL); | |
} | |
int main() { | |
node* top = NULL; | |
add_to_all(&top, 42); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment