Created
August 31, 2017 09:53
-
-
Save izmajlowiczl/51ca32877c93e851035f2d2c9351b00a 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
struct node { | |
int value; | |
struct node *next; | |
}; | |
void push_front(struct node* root, int value) { | |
struct node* new_root = create_node(value); | |
if (!new_root) ERR("Cannot allocate memory for node to add/n"); | |
new_root->next = root; | |
root = new_root; | |
} | |
int main(void) { | |
struct node root; | |
root.value = 1; | |
root.next = NULL; | |
push_front(&root, 10); | |
traverse(&root); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment