Can anyone please tell what's wrong with my code for quick sort?? vscode ain't showing any error, and even in online ide, they're just showing limited resources or something and I just don't know what's wrong with it its just not showing output Here this is the code enter code here
#include<stdio.h>
void swap( int* x, int* y)
{
int t = *x;
*x = *y;
*y = t;
}
int part( int a[], int l, int h )
{
int i = l-1, p = a[h] ;
for( int j=l; j<= h-1; j++ )
{
if( a[j]<p )
{
i++;
swap( &a[i], &a[j] );
}
}
swap( &a[i+1], &p);
return (i+1);
}
void qsort( int a[], int l, int h )
{
if( l<h )
{
int pi = part( a, l, h);
qsort( a, (pi+1), h );
qsort( a, l, (pi-1) );
}
}
void print_arr( int a[], int n )
{
for( int i=0; i<n; i++ )
{
printf("%d", a[i] );
}
}
int main()
{
int a[100], n ;
printf("Enter the total no. of elements in the array : ");
scanf("%d", &n );
printf("Enter the elements in the array : ");
for(int i=0; i<n; i++)
{
scanf("%d", &a[i] );
}
qsort( a, 0, (n-1) );
printf("The sorted array is : ");
print_arr( a, n );
return 0 ;
}