Advertisement
Guest User

Untitled

a guest
Jan 25th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. int del(char* key)
  2. {
  3. _Bool ans = 0;
  4. unsigned int index = hashFunc(key) % SIZE;
  5. if (strcmp(mas[index]->key, key) == 0)
  6. {
  7. scanf("%i", &ans);
  8. if (ans == 1)
  9. if (mas[index]->next == NULL)
  10. return NULL;
  11. else
  12. {
  13. element* temp = mas[index];
  14. do
  15. {
  16. if (strcmp(temp->next->key, key) == 0)
  17. {
  18. scanf("%i", &ans);
  19. if (ans == 1)
  20. {
  21. if (temp->next->next == NULL)
  22. {
  23. temp->next = NULL;
  24. return NULL;
  25. }
  26. else
  27. {
  28. element* temp2;
  29. do
  30. {
  31. if (temp->next == NULL)
  32. {
  33. temp = NULL;
  34. return;
  35. }
  36. else
  37. {
  38. temp2 = temp->next;
  39. temp->next = temp->next->next;
  40. temp->next->next = temp2;
  41. }
  42. temp2 = temp2->next;
  43. } while (1);
  44. }
  45. }
  46. }
  47. temp = temp->next;
  48. }while (1);
  49. }
  50. }
  51. else
  52. {
  53. element* temp = mas[index];
  54. do
  55. {
  56. if (strcmp(temp->next->key, key) == 0)
  57. {
  58. scanf("%i", &ans);
  59. if (ans == 1)
  60. {
  61. if (temp->next->next == NULL)
  62. {
  63. temp->next = NULL;
  64. return NULL;
  65. }
  66. else
  67. {
  68. element* temp2;
  69. do
  70. {
  71. temp->next = temp->next->next;
  72. temp2 = temp->next->next;
  73. if (temp2->next == NULL)
  74. return NULL;
  75. temp2 = temp2->next;
  76. } while (1);
  77. }
  78. }
  79. }
  80. temp = temp->next;
  81. } while (1);
  82. }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement