Write C Program Create Dictionary Using Linked List File Handling Q37105019

write a c program to create dictionary using linkedlist and file handling


Solution


#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define pf printf
#define sf scanf
struct SinglyList
{
   char key[20];
   char value[20];
   struct SinglyList *next;

};

struct SinglyList *Create_A_Node(char *key,char *value)
{
   struct SinglyList *node;

   node = (struct SinglyList *) malloc(sizeof(structSinglyList));

   strcpy(node->key,key);
   strcpy(node->value,value);
   node->next = NULL;

   return node;
}

struct SinglyList *Insert(struct SinglyList *head,char *key,char*value)
{

   struct SinglyList *temp=head,*node=head;
   if(head == NULL)
       returnCreate_A_Node(key,value);

   else
   {
          while(strcmp(temp->key,key)<0)
           {
              node = temp;
              temp = temp->next;
              if(temp == NULL)
                  break;
           }
       //Orders Node On their Key ValueAlphabetically

       if(temp == head)
  

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.