I'm trying to make a function that will change an array of numbers into an array of different numbers. I have to return the array, but I'm not sure how to declare a function that returns an array.
1 2 3 4 5 6 7 8 9
int[5] getCommunityValue(int c[5]) {
int array[5];
for (int i =0; c[i]!=0; i++) {
--c;
int v = *c % 13;
array[i]=v;
}
return array;
}.
You may not return an array from a function. Either you will pass the second array as a parameter of the function or you should dynamically allocate the second array and return the pointer.
Take into account that your function apart from the return value is invalid.