"alix" <a160978@yahoo.com> wrote:
>
>I need a code to find the kth smalest number in an unsorted array.


dear alix,
since ur question was not really clear.i think kth smallest element in any
unsorted array can be found by first sorting it in ascending order and reading
then reading the kth element of the array.as under

void main()
{
int *a;
int k,n;
printf("enter the kth position u want and the array length");
scanf("%d %d",&k,&n);
printf("enter the elements of array");
for(int i=0;i<=n;i++)
scanf("%d",(a+i));
for(i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
if(*(a+i)>*(a+j))
{
temp=*(a+i);
*(a+i)=*(a+j);
*(a+j)=temp;
}
}
}
printf("the %d smallest element is %d",k,*(a+k));
}
\\i think this should serve ur purpose,if not mail me at my e-mail.