Created
May 9, 2016 21:14
-
-
Save jianminchen/cd219738d812605e0c6ced926d2e488c to your computer and use it in GitHub Desktop.
HackerRank - LinkedList - Print a list
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
/* | |
Print elements of a linked list on console | |
head pointer input could be NULL as well for empty list | |
Node is defined as | |
struct Node | |
{ | |
int data; | |
struct Node *next; | |
} | |
*/ | |
void Print(Node *head) | |
{ | |
if(head==NULL) | |
return; | |
printf("%d\n", head->data); | |
Print(head->next); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment