Advertisement
thexiv

Untitled

Nov 12th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.76 KB | None | 0 0
  1.  
  2. Node *insert(Node *H, int index, char *number)
  3. {
  4.  
  5.     Node *check = H;
  6.     if (H == NULL)
  7.     {
  8.         Node *newNode = (Node *)malloc(sizeof(Node));
  9.         newNode->definition = number;
  10.         newNode->next = NULL;
  11.         check->next = newNode;
  12.         return check;
  13.     }
  14.  
  15.     while (check->next != NULL)
  16.     {
  17.         check = check->next;
  18.     }
  19.     Node *newNode = (Node *)malloc(sizeof(Node));
  20.     newNode->definition = number;
  21.     newNode->next = NULL;
  22.     check->next = newNode;
  23.     return check;
  24. }
  25.  
  26. //Trying to create alphabetized LList ------------------------
  27.  
  28.     cout << "#" << flush;
  29.     for (string x1 : fin_str_set)
  30.     {
  31.         char * x2 = {(char *)x1.c_str()};
  32.         insert(x, 0, x2);
  33.     }
  34.     cout << "#" << flush;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement