From 71a8dbd8466c5efab021d16aabaa23368bbd103d Mon Sep 17 00:00:00 2001 From: NeerajSati <63944649+NeerajSati@users.noreply.github.com> Date: Fri, 2 Oct 2020 18:42:08 +0530 Subject: [PATCH 1/2] Update Program_to_Create_a_linked_list.c --- .../Program_to_Create_a_linked_list.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/DS assignment 3/Program_to_Create_a_linked_list.c b/DS assignment 3/Program_to_Create_a_linked_list.c index a69bcef..054e323 100644 --- a/DS assignment 3/Program_to_Create_a_linked_list.c +++ b/DS assignment 3/Program_to_Create_a_linked_list.c @@ -40,11 +40,12 @@ int main() } int ch; + addNode: printf("Want to add more values to linked list press 1...\n "); scanf("%d", &ch); if (ch == 1) { - addNode: + printf("Enter the next value\n "); int value; scanf("%d", &value); @@ -62,18 +63,9 @@ int main() printList(head); goto end; } - printf("Want to add more values to linked list press 1...\n "); - scanf("%d", &ch); - if (ch == 1) - { - goto addNode; - } - else - { - printf("Your Linked List..\n"); - printList(head); - } - + + goto addNode; + end: return 0; } From c62d26dc2e405d17c03b7534cbaef7d87341aea9 Mon Sep 17 00:00:00 2001 From: Divyanshu1310 <73689602+Divyanshu1310@users.noreply.github.com> Date: Fri, 30 Oct 2020 14:17:10 +0530 Subject: [PATCH 2/2] Update Program_to_Create_a_linked_list.c --- DS assignment 3/Program_to_Create_a_linked_list.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/DS assignment 3/Program_to_Create_a_linked_list.c b/DS assignment 3/Program_to_Create_a_linked_list.c index 054e323..2c3f358 100644 --- a/DS assignment 3/Program_to_Create_a_linked_list.c +++ b/DS assignment 3/Program_to_Create_a_linked_list.c @@ -1,10 +1,6 @@ -//DSA //Write a program to create a linkedList -//Name-Sai Prashant Saxena -//Roll no-02220902719 - #include #include @@ -20,10 +16,10 @@ int main() struct node *head = (struct node *)malloc(sizeof(struct node)); struct node *temp = head; printf("Hello there!!"); - printf("\nWant to create a linked list press Y.....\n\t\t"); + printf("\nWant to create a linked list press 1.....\n\t\t"); char c; scanf("%c", &c); - if (c == 'Y' || c == 'y') + if (c == 1) { printf("Enter the value of head\n "); int value; @@ -75,7 +71,7 @@ void printList(struct node *head) printf("\n"); while (temp != NULL) { - printf("-->%d Address of node: %d",temp->info,temp); + printf("-->%d ",temp->info); printf("\t Next:%d\n",temp->link); temp = temp->link; }