do
{
swap=false;
for(int i=0; i<256; i++)
{
if(pd[i]<pd[i+1])
{
int temp=pd[i];
pd[i]=pd[i+1];
pd[i+1]=temp;
swap=true;
}
}
}
while(swap);
It only returns top two results properly and the rest as 0. I am sorting floats.