Created
October 11, 2017 16:47
-
-
Save RafaelGSS/2d6a39db385fef53433e32d0179c2188 to your computer and use it in GitHub Desktop.
Simple example List
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 LNode { | |
| int data; | |
| LNode* next; | |
| LNode(int n){data = n; next = NULL;} | |
| void add_to_end(int n) { | |
| if (next) | |
| next->add_to_end(n); | |
| else | |
| next = new LNode(n); | |
| } | |
| ~LNode() { delete next; } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment