I know sorting an array is common and must be known for a beginner, But i am a little confuse here i tried some methods which came in my mind but failed !
Now,
g_Array[10] = {0,5,6,1,9,2,4,6,7,2}
if we sort it in descending order we get
9
7
6
5
...
0
but i want to store their place holders too
g_Holders[10]
4 ( cause it contains 9)
8 ( cause it contains 7)
and so on ...
the method i used to sort array (which i m currently learning in my school),
you can tell me another method too, if its working i would have no problem in using it !
PHP Code:
new g_Array[10] = {0,5,6,1,9,2,4,6,7,2}
new g_Temp
server_print("Array Test")
for(new k=1;k<10;k++)
{
for(new j=0;j<(10-k);j++)
{
if(g_Array[j]<g_Array[j+1])
{
g_Temp = g_Array[j];
g_Array[j] = g_Array[j+1];
g_Array[j+1] = g_Temp
}
}
}
for(new j=0;j<10;j++)
{
server_print("%i",g_Array[j]);
}
how can i get their place holders ?