Advertisement
Idanref

Untitled

Apr 7th, 2021
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. typedef struct Node
  6. {
  7. char data;
  8. struct Node* next;
  9. } node;
  10.  
  11. node *create_node(char data)
  12. {
  13. node* temp = (node*)malloc(sizeof(node));
  14.  
  15. temp->data = data;
  16. temp->next = NULL;
  17.  
  18. return temp;
  19. }
  20.  
  21. // node* insert
  22.  
  23. void print_list(node* head)
  24. {
  25. if(head == NULL)
  26. {
  27. printf("List is empty\n");
  28. }
  29.  
  30. node* temp = head;
  31.  
  32. while (temp != NULL)
  33. {
  34. printf("%c->", temp->data);
  35. temp = temp->next;
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement