traversing a linked list

Run Settings
LanguageC
Language Version
Run Command
#include <stdio.h> struct Node { int data; struct Node* next; }; void printlist(struct Node* temp) { printf("Linked list is \n "); while(temp != NULL) { printf("%d ", temp->data); temp = temp->next; } } int main(void) { printf("Hello World!\n"); struct Node * head = NULL; struct Node * second = NULL; struct Node* third = NULL; head = (struct Node*)malloc(sizeof(struct Node)); second = (struct Node*)malloc(sizeof(struct Node)); third = (struct Node*)malloc(sizeof(struct Node)); head->data = 1; head->next = second ; second->data = 2; second->next = third ; third->data = 3; third->next = NULL ; printlist(head); return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines