Stupmach (Stupid Machine)

#include

using namespace std;

int func(int arr[], int limit)

{

for (int i = 0; i < limit; i++)

{

    arr[i] = arr[i] - 1;

    if (arr[i] == 0)

        return arr, i;

}

}

int main()

{

int t;

cin >> t;

while (t--)

{

    int n;

    cin >> n;

    int arr[n], l = n, total = n, value;

    for (int i = 0; i < n; i++)

    {

        cin >> arr[i];

    }

again:

    arr, value = func(arr, l);

    if (value != 0)

    {

        total += value;

        l = value;

        goto again;

    }

    else

    {

        cout << total << endl;

    }

}

return 0;

}
whats wrong with my code i know implementation could be better but whats wrong with this approach. Is there any test case where this code fails?
pls help.

give the code link please…it’s becoming a little tough to understand by seeing it here

post link to question

https://www.codechef.com/viewsolution/34709527