Context: In helpers.c
, I can make the sort
function actually sort the values[]
array.
Problem: However, I don't know how to re-inject this sorted array back in main without using pointers.
Question: How to "update" the haystack array via sort(haystack, size);
when sort
returns void, and haystack
is a local variable, without using pointers ?
Indeed, if one could modify the definition of sort
, it would be easy to modify haystack
via something like haystack=sort(haystack, size);
.
I could also change haystack
directly in sort
is the variable was global.
I don't want to use pointers, because it was not taught yet and thus there might be another solution I'd like to find.