| 162 | } |
| 163 | |
| 164 | int deletion() |
| 165 | { |
| 166 | int index; |
| 167 | insertDeleteCheckpoint: |
| 168 | printf("Enter the index of the element you want to delete\n"); |
| 169 | scanf("%d", &index); |
| 170 | if (index >= 0 && index <= a1.counter) |
| 171 | { |
| 172 | for (int i = index; i <= a1.counter; i++) |
| 173 | { |
| 174 | a1.array1[i] = a1.array1[i + 1]; |
| 175 | } |
| 176 | a1.counter--; |
| 177 | printArr(); |
| 178 | } |
| 179 | else |
| 180 | { |
| 181 | printf("Index out of range\n"); |
| 182 | goto insertDeleteCheckpoint; |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | int traversing() |
| 187 | { |