I'm doing a function that returns the index of the largest integer in the array it's an easy function.I've done it but I don't know why the output is always 10 although i want to return only the index of the largest number and here is my code:
int MAX_INT(int arr,int s)
const int SIZE=10;
You're making life difficult on yourself:
Define a variable max, set it equal to the first element of the array
Step through the array, if the current element in the array is greater than max, let max be equal to that element, and set temp = index. Only change the index if you find a new max.