user40017: Say we have an array named myMeasurements 
int myMeasurements[9]={3,4,8,12,7,2,1,67,8};

How can I find the index of the maximum element of this array?
For example the MATLAB code would be:
myMeasurements = [3,4,8,12,7,2,1,67,8];
[maxValue,Index] = max(myMeasurements);

where maxValue is returned as 67 whereas the Index is returned as 8.
For the record, I am using Teensy 3.2 and I program it with the Arduino IDE using the Teensyduino add-on.

user10214: First of all, do you really need int values for the measurements or not? If not, and you have numbers between 0 and 255, switch the values to byte, your microcontroller will thank you.
Then, there is a problem with the other answers, which is... The variables cannot be left uninitialized!!! You can use this code to get the info you need:
(I also put the size of myMeasurements in a const variable.. You can thank me later for this)
const byte maxMeasurements = 9;
int myMeasurements[maxMeasurements ]={3,4,8,12,7,2,1,67,8};

byte maxIndex = 0;
int maxValue = myMeasurements[maxIndex];

for(byte i = 1; i < maxMeasurements; i++)
{
    if(myMeasurements[i] > maxValue) {
        maxValue = myMeasurements[i];
        maxIndex = i;
    }
}


40017: <p>Say we have an array named <code>myMeasurements</code> </p>

<pre><code>int myMeasurements[9]={3,4,8,12,7,2,1,67,8};
</code></pre>

<p><strong>How can I find the index of the maximum element of this array?</strong></p>

<p>For example the MATLAB code would be:</p>

<pre><code>myMeasurements = [3,4,8,12,7,2,1,67,8];
[maxValue,Index] = max(myMeasurements);
</code></pre>

<p>where <code>maxValue</code> is returned as 67 whereas the <code>Index</code> is returned as 8.</p>

<p>For the record, I am using Teensy 3.2 and I program it with the Arduino IDE using the Teensyduino add-on.</p>
 10214: <p>First of all, do you really need int values for the measurements or not? If not, and you have numbers between 0 and 255, switch the values to byte, your microcontroller will thank you.</p>

<p>Then, there is a problem with the other answers, which is... The variables cannot be left uninitialized!!! You can use this code to get the info you need:</p>

<p>(I also put the size of myMeasurements in a const variable.. You can thank me later for this)</p>

<pre><code>const byte maxMeasurements = 9;
int myMeasurements[maxMeasurements ]={3,4,8,12,7,2,1,67,8};

byte maxIndex = 0;
int maxValue = myMeasurements[maxIndex];

for(byte i = 1; i &lt; maxMeasurements; i++)
{
    if(myMeasurements[i] &gt; maxValue) {
        maxValue = myMeasurements[i];
        maxIndex = i;
    }
}
</code></pre>
