Created
April 22, 2025 14:00
-
-
Save fabianbaechli/3eecb05f19b3c62ea42f0c77cd58d678 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 val; | |
| struct node* next; | |
| }; | |
| struct Node* newNode(int val) { | |
| struct Node* p = malloc(sizeof(struct Node)); | |
| p->val = val; | |
| return p; | |
| } | |
| int main() { | |
| struct Node* root = newNode(0); | |
| struct Node* p = root; | |
| for(int i = 1; i < 10; i++) { | |
| p -> p = newNode(i); | |
| p = p -> next; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment