If you were to do this iteratively, how would you do it? I would assume something like this:
void getss(int array[], int size) {
int i;
for (i = 0; i < size; i++) {
scanf("%d", array[i]);
}
}
Our i there just serves to count our way through the array, so if we change our function slightly we can get rid of it:
void getss(int* array, int size) {
for (; size > 0; size--, array++) {
scanf("%d", array);
}
}
Now our "counter" is the size variable itself and instead of indexing in our array we just keep stepping forward our pointer to it.
Now this is in a perfect form to be turned into a recursive function. Instead of size-- and array++ we can pass the new values into another call to getss at the end of the function:
void getss(int* array, int size) {
if (size > 0) {
scanf("%d", array);
getss(array + 1, size - 1);
}
}
So our loop's terminating condition has moved into an if and instead of array++ and size-- we pass in array+1 and size-1 to our next call. It achieves the same result as looping but without an explicit loop construct.
iis undeclared. Should probably besizeinstead. But even then,array[0]is never written to.