Finding the position of the max element

Posted by Faken on Stack Overflow See other posts from Stack Overflow or by Faken
Published on 2010-06-01T21:31:17Z Indexed on 2010/06/01 21:53 UTC
Read the original article Hit count: 237

Filed under:
|

Is there a standard function that returns the position(not value) of the max element of an array of values?

For example:

say i have an array like this:

sampleArray = [1, 5, 2, 9, 4, 6, 3]

I want a function that returns the integer of 3 that tells me that sampleArray[3] is the largest value in the array.

© Stack Overflow or respective owner

Related posts about c++

Related posts about algorithm