This is in case you want to increase the found elements later on from just the 2 highest to more
First you‘d want to remove all the duplicates.
For that, you need to go through each Element of the array and check wether it‘s already been there.
Which you can do with 2 ways, one by adding them to another array and then just compare, or by simply comparing them to all the other Elements in the array and check if you found another one.
If so, remove the duplicates.
Now, create a second int array of size 2. (we‘ll call it result
Set result[0] to the first Element of the other array and result[1] to the second.
Then just loop over the first array, starting from the index 2.
Within the loop, check if the number is bigger than any of the 2 values in result.
If it is, replace each element in result with the one before it ([1]=[0])and then set the first to our new highest value and then break the loop (using break;).
Once this is done, you‘ll have an array result of size 2 with [0] being 9 and [1] being 8.
Else, if you only want the 2 highest
Just create 2 variables (4 if you want the actual int reference, not just the value)
Loop through the whole array.
If the value is higher than var1, set var2 to var1 and var1 to the value. (And set idx2 to idx1 and idx1 to the current index, if you want this too).
Done. Var1 is the highest, while var2 is the second highest