#include
#define N 8
#define swap(array,x,y)\
{\
int temp; \
temp = array[x]; \
array[x] = array[y]; \
array[y] = temp; \
}
int array[N] = {5,3,6,2,9,7,4,1} ;
void sort_compare(int *array,int n)
{
int i,j,*p=array;
for(i=0;i {
for(j=i+1;j {
if(*(p+i) > *(p+j))
swap(array,i,j);
}
}
}
void print_array(int *array,int n)
{
int i;
printf("\n\narray is :");
for(i=0;i {
printf("%d ",*(array+i));
}
putchar('\n');
return ;
}
int main(int argc,char *argv[])
{
print_array(array,N);
sort_compare(array,N);
print_array(array,N);
return 0 ;
}