Created
April 21, 2018 01:59
-
-
Save saifsmailbox98/e8b35a903b30dcc9c7f89e6bb6ac4d81 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
| #include < stdio.h > | |
| struct Node { | |
| int data; | |
| struct Node * next; | |
| }; | |
| void display(struct Node * next) { | |
| while (next != NULL) { | |
| printf("%d", next - > data); | |
| next = next - > next; | |
| } | |
| } | |
| void main() { | |
| struct Node * head; | |
| struct Node * second; | |
| clrscr(); | |
| head = (struct Node * ) malloc(sizeof(struct Node)); | |
| second = (struct Node * ) malloc(sizeof(struct Node)); | |
| printf("Enter the data of 1st node."); | |
| scanf("%d", & head - > data); | |
| head - > next = second; | |
| printf("Enter the data of 2nd node."); | |
| scanf("%d", & second - > data); | |
| second - > next = NULL; | |
| display(head); | |
| getch(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment