बिजनेस मार्केटिंग का लो कॉस्ट फंडा , अपने मोबाइल से ऑटो sms भेजकर मार्केटिंग करे विजिट करे http://autotextsms.com/ बिजनेस मार्केटिंग का लो कॉस्ट फंडा http://autotextsms.com/

Search This Blog

Translate

Showing posts with label linked list program in c with explanation. Show all posts
Showing posts with label linked list program in c with explanation. Show all posts

Create a linked list and display the elements in the list

simple linked list program in c
linked list program in c with explanation
linked list program in c++
linked list program in c for insertion and deletion
singly linked list program in data structure using c
linked list program in c pdf
how to create a linked list in c++
how to create a linked list java

Create a linked list and display the elements in the list

 #include <stdio.h>
#include <malloc.h>
 #include <stdlib.h>
 void main() {
 struct node { int num; struct node *ptr;
 };
typedef struct node NODE; NODE *head, *first, *temp = 0; int count = 0; int choice = 1; first = 0; while (choice)
 { head = (NODE *)malloc(sizeof(NODE));
 printf("Enter the data item\n"); scanf("%d", &head-> num);
 if (first != 0) { temp->ptr = head; temp = head; }
else { first = temp = head; } fflush(stdin);
 printf("Do you want to continue(Type 0 or 1)?\n");
scanf("%d", &choice); } temp->ptr = 0;
 /* reset temp to the beginning */
 temp = first; printf("\n status of the linked list is\n");
                       while (temp != 0)
 { printf("%d=>", temp->num); count++; temp = temp -> ptr; }
 printf("NULL\n"); printf("No. of nodes in the list = %d\n", count);

}




  • simple linked list program in c
  • linked list program in c with explanation
  • linked list program in c++
  • linked list program in c for insertion and deletion
  • singly linked list program in data structure using c
  • linked list program in c pdf
  • how to create a linked list in c++
  • how to create a linked list java





C Program example List