-
Array Sortting
I am a beginer in C, i have a problem that i hope somebody will help me.
I put a numbers of value in the array such as (a long list);
x[0]=10;
x[1]=20;
x[2]=5;
x[3]=15;
x[4]=8;
i need to find out which array have the smallest value, so the answer is array number #2. ( i need array number, not the value in the array).
how should i do to use "for" looping ?
Thanks,
-
You're thread title is about "sorting" then you ask how to find the smallest value. That's two different things, so which do you _really_ want to do?
The find the smallest value, simply loop through the array, checking each element. There are numerous examples of "for" loops on the forum, even some doing exactly as you require. Do a search and see what you can find.