Preview:
#include <stdio.h>

int find_min_index(int* numbers, int length);

int main(void)
{
    int array1[] = { 1, 3, 5, 7, 9, 11 };
    int array2[] = { 2, -4, 6, -8, 10, -12, 14, -16, 4 };
    int array3[] = { 6, 4, 1, 4, 5, 3, 2 };
 
    printf("Min's index in array1 is: %d\n", find_min_index(array1, 6));
    printf("Min's index in array2 is: %d\n", find_min_index(array2, 9));
    printf("Min's index in array3 is: %d\n", find_min_index(array3, 7));
 
    return 0;
}

int find_min_index(int* numbers, int length)
{
    // TODO: Insert your code here!
    
    int min_index = 0;
    
    for(int i = 0; i < length; i++)
    {
        if( numbers[i] < numbers[min_index] )
        {
            min_index = i;
        }
    }
    return min_index;
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter