Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #define SIZE 12
- int main() {
- int arr[SIZE] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
- int size = SIZE;
- int i = 0;
- int pos = 4;
- int sz = size - 1;
- int i_next = 0;
- // show defaulp array
- for (i = 0; i < size; i++)
- printf("%d\t", arr[i]);
- printf("\n\n");
- for (i = pos - 1; i < sz; i++) {
- i_next = i + 1;
- printf("i = %d\n", i);
- arr[i] = arr[i_next];
- }
- printf("\n\n");
- // update the size
- size--;
- // print new array
- for (i = 0; i < size; i++)
- printf("%d\t", arr[i]);
- printf("\n");
- return 0;
- }
Add Comment
Please, Sign In to add comment