From 0e42b42d0b31a4752bd30410bdd46e12a47105f0 Mon Sep 17 00:00:00 2001 From: UdaySantoshKumar <75845600+udaysk3@users.noreply.github.com> Date: Sun, 3 Oct 2021 18:57:39 +0530 Subject: [PATCH 1/2] added new program this is a c program to create and display a linked list --- program-72/program.c | 52 ++++++++++++++++++++++++++++++++++++++++++++ program-72/readme.md | 3 +++ 2 files changed, 55 insertions(+) create mode 100644 program-72/program.c create mode 100644 program-72/readme.md diff --git a/program-72/program.c b/program-72/program.c new file mode 100644 index 00000000..e5d23b81 --- /dev/null +++ b/program-72/program.c @@ -0,0 +1,52 @@ +#include +#include +struct Node +{ + int data; + struct Node *next; +}*first=NULL; +void create(int A[],int n) +{ + int i; + struct Node *t,*last; + first=(struct Node *)malloc(sizeof(struct Node)); + first->data=A[0]; + first->next=NULL; + last=first; + + for(i=1;idata=A[i]; + t->next=NULL; + last->next=t; + last=t; + } +} +void Display(struct Node *p) +{ + while(p!=NULL) + { + printf("%d ",p->data); + p=p->next; + } +} +void RDisplay(struct Node *p) +{ + if(p!=NULL) + { + RDisplay(p->next); + printf("%d ",p->data); + + } +} +int main() +{ + struct Node *temp; + int A[]={3,5,7,10,25,8,32,2}; + create(A,8); + + Display(first); + + return 0; +} \ No newline at end of file diff --git a/program-72/readme.md b/program-72/readme.md new file mode 100644 index 00000000..3f17c521 --- /dev/null +++ b/program-72/readme.md @@ -0,0 +1,3 @@ +program 72 + +C program to create and display a linked-lists \ No newline at end of file From 2cf0be0ea49e0245982369c82cc4bb6b3553b8a1 Mon Sep 17 00:00:00 2001 From: UdaySantoshKumar <75845600+udaysk3@users.noreply.github.com> Date: Sun, 3 Oct 2021 18:59:28 +0530 Subject: [PATCH 2/2] added new program this is a c program to create and display a linked list --- C/program-72/program.c | 52 ++++++++++++++++++++++++++++++++++++++++++ C/program-72/readme.md | 3 +++ 2 files changed, 55 insertions(+) create mode 100644 C/program-72/program.c create mode 100644 C/program-72/readme.md diff --git a/C/program-72/program.c b/C/program-72/program.c new file mode 100644 index 00000000..e5d23b81 --- /dev/null +++ b/C/program-72/program.c @@ -0,0 +1,52 @@ +#include +#include +struct Node +{ + int data; + struct Node *next; +}*first=NULL; +void create(int A[],int n) +{ + int i; + struct Node *t,*last; + first=(struct Node *)malloc(sizeof(struct Node)); + first->data=A[0]; + first->next=NULL; + last=first; + + for(i=1;idata=A[i]; + t->next=NULL; + last->next=t; + last=t; + } +} +void Display(struct Node *p) +{ + while(p!=NULL) + { + printf("%d ",p->data); + p=p->next; + } +} +void RDisplay(struct Node *p) +{ + if(p!=NULL) + { + RDisplay(p->next); + printf("%d ",p->data); + + } +} +int main() +{ + struct Node *temp; + int A[]={3,5,7,10,25,8,32,2}; + create(A,8); + + Display(first); + + return 0; +} \ No newline at end of file diff --git a/C/program-72/readme.md b/C/program-72/readme.md new file mode 100644 index 00000000..3f17c521 --- /dev/null +++ b/C/program-72/readme.md @@ -0,0 +1,3 @@ +program 72 + +C program to create and display a linked-lists \ No newline at end of file