I have this code:
#include <stdio.h>
void replaceIndexElement (int index, int element);
int main ()
{
replaceIndexElement(2, 3);
return 0;
}
void replaceIndexElement (int index, int element) {
int mainArr[10] = {0, 2, 1000, 6, 9, 11, 43, 8, 123, 87};
mainArr[index] = element;
for (int i = 0; i < 10; i++) {
printf("%d\n", mainArr[i]);
}
}
I need pass array mainArr to function argument to pass any array and change the element by index.
I have some errors after passing array to argument.