Indentation helps a lot when you look at code: it means you can see what is goign on a lot more clearly...
But a quick glance says that the swap function:
void swap(int *i,int *k)
{int j;
*i=*k;
*k=j;
}
Is not going to work!
What value do you put in
k
each time?
Try changing it to:
void swap(int *i,int *k)
{
int j;
j = *i;
*i = *k;
*k = j;
}
And that at least will work better!
In future, use the debugger: it would have shown you that problem in seconds, instead of the minutes it took you to ask here, then the time you had to wait for us to see the question, then the time for you to get an email that there is an answer...