From f4d0b1db2fd2603e2d8018608cc558590e09e707 Mon Sep 17 00:00:00 2001 From: Siddharth Batra Date: Mon, 1 Oct 2018 00:20:26 +0530 Subject: [PATCH 1/2] created linkedlist.h as suggested --- CPP/data-structures/LinkedList.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 CPP/data-structures/LinkedList.h diff --git a/CPP/data-structures/LinkedList.h b/CPP/data-structures/LinkedList.h new file mode 100644 index 0000000..561f1c4 --- /dev/null +++ b/CPP/data-structures/LinkedList.h @@ -0,0 +1,23 @@ +struct node { + struct node* next; + int data; +}; + +struct node* head=NULL,*temp=NULL,*newn; + +void printll() +{ + if(head==NULL) + { + cout<<"Empty List"; + return; + } + else{ + temp=head; + while(temp!=NULL) + { + cout<data<<" "; + temp=temp->next; + } + } +} From 363b319469903233f9dc74167c46f13a8d0bf49c Mon Sep 17 00:00:00 2001 From: Siddharth Batra Date: Mon, 1 Oct 2018 00:28:08 +0530 Subject: [PATCH 2/2] Update LinkedList.h --- CPP/data-structures/LinkedList.h | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/CPP/data-structures/LinkedList.h b/CPP/data-structures/LinkedList.h index 561f1c4..35c00ff 100644 --- a/CPP/data-structures/LinkedList.h +++ b/CPP/data-structures/LinkedList.h @@ -1,23 +1,11 @@ +#ifndef LINKEDLIST_H +#define LINKEDLIST_H struct node { struct node* next; int data; }; -struct node* head=NULL,*temp=NULL,*newn; +struct node* head=NULL, *temp=NULL, *newn; -void printll() -{ - if(head==NULL) - { - cout<<"Empty List"; - return; - } - else{ - temp=head; - while(temp!=NULL) - { - cout<data<<" "; - temp=temp->next; - } - } -} +void printll(); +#endif