Suppose I have an array
int arr[] = {...}; arr = function(arr);
I have the function as
int& function(int arr[]) { //
You're returning a reference to an int, not a reference to an array.
You want :
(int*)& function(int arr[]) { /// rest of the code return arr; }
That said, as others already said, that's not good practice.