I am trying to find the element number in an array. I already found the minimum number, but I need to find the element number of that minimum number. Here's the code:
Code:
#include <stdio.h>
#include <conio.h>
float minimum(float[], int);
int main()
{
int a;
float ticketPrices[6];
for (a=0;a<=5;++a) /*enter 6 ticket prices*/
{
printf("Please enter the ticket prices: ");
scanf("%f", &ticketPrices[a]);
}
for (a=0;a<=5;++a)
printf("\nTickets prices that you entered are: %.2f", ticketPrices[a]);
printf("\nThe minimum value is: %.2f", minimum(ticketPrices, 6));
printf("\nThis is element number: %d", );
getch();
return 0;
}
float minimum(float number[], int numEls)
{
int a;
float min=number[0];
for (a=1;a<numEls;++a)
if(min>number[a])
min=number[a];
return(min);
}
The only help I need is where the printf statement is bold. Not sure how to find the subscript number (element number). Do I need another variable in the For loop? Thanks......Tommy