I have written this code for insertion sort but, its not generating any output.
could you please tell me whats wrong in this code
Thanks!!
#include<stdio.h>
#include<conio.h>
int main()
{
int arr[25]={1,2,3,4,5,6,7,8,9,21,15,16,18,22,24,72,77,79,91,62,27,35,11,90,110},i,temp=0,j,a;
int *p;
for(i=0;i<25;i++)
{
if (arr[i]>arr[i+1])
{
temp=arr[i];
arr[i]=arr[i+1];
arr[i+1]=temp;
p=&arr[i];
while(i!=0)
{
if(*p<arr[i-1])
{
temp=*p;
*p=arr[i-1];
arr[i-1]=temp;
}
else
{
continue;
}
i--;
}
}
else
{
continue;
}
}
for(i=0;i<25;i++)
{
printf("\n %d",arr[i]);
}
getch();
}