Skip to content

Instantly share code, notes, and snippets.

@johnsogg
Created February 15, 2013 16:24
Show Gist options
  • Save johnsogg/4961478 to your computer and use it in GitHub Desktop.
Save johnsogg/4961478 to your computer and use it in GitHub Desktop.
#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