Selection sort array swapping problem

https://ide.codingblocks.com/s/57957
why it is showing zero in output after swap

Hey Shaantanu, your code is not correct, you are supposed to swap the elements in if check only. So update your for loop like this

 for(i=0;i<n-1;i++)
    {
        // min=var[i];
        // min_index=i;
        for(j=i+1;j<n;j++)
        {
            if(var[j]<var[i])
            {
                // min=var[j];
                // min_index=j;
				swap(var[i],var[j])
            }
        }
            // swap(var[i],var[min_index]);
    }