0
Help for Array code
#include <stdio.h> #define ARRSIZE 5 int main() { int arr[] = { 1, 2, 3, 4, 5 }; printf("Original array:\n"); for (int i=0; i < ARRSIZE; i++) printf("%d ", arr[i]); printf("\n"); int index = 2; printf("Index to be removed: %d\n", index); /* insert code here to remove the element whose index is index from the array */ printf("Printing the array after removing the element at index %d: ", index); for (int i=0; i < ARRSIZE; i++) printf("%d ", arr[i]); }
3 Answers
+ 2
Take input of index, check index if value is in array size..
Now from that index copy value at index i+1 to i, ingore last index value.. Redefine ArrSize by 1 less one.
Or just copy into new array by except that index value.
Or make 0 or negative value at that index, and don't print that value when printing using condition if(a[i] >0) print else no..
0
Complete the following C program by inserting code in the space provided to remove the element from the array whose index is provided in the variable index.
Test your program several times and using different indices to make sure it works all the time.
Hand in your completed C program and a screen shot of the output of your program using any index.
0
How can I do it?



