Coding-Problem Solving

Thursday, 18 January 2018

Predefined Quick Sort Implementation in C

#include<stdio.h>
#include<stdlib.h>
int cmp(const void *a,const void *b){
return(*(char *)b-*(char *)a);

}

int main()
{
int i;
char arr[10];
printf("Enter elements:");
for(i=0;i<10;i++)
{
scanf("%c",&arr[i]);
}
qsort(arr,10,sizeof(char),cmp);
fputs(arr,stdout);
return 0;
}
Posted by Shivam at 06:41
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

About Me

Shivam
View my complete profile

Blog Archive

  • ▼  2018 (18)
    • ►  March (2)
    • ►  February (3)
    • ▼  January (13)
      • GCD and LCM of n numbers stored in an array.
      • Implementing Graph by Adjacency List using Java
      • Queue using Two Stacks
      • C Program to find pair whose sum is closest to zero.
      • Predefined Quick Sort Implementation in C
      • C Program to check whether a string is Pangram
      • C Program to understand some basic operations on l...
      • C program to sort numbers using Insertion Sort
      • C Program to sort the numbers using Heap Sort
      • C Program to find first repeating character in a s...
      • C Program to reverse a string.
      • C Program to Sort Numbers using Bubble Sort
      • C Program to search numbers using Binary Search.
  • ►  2017 (2)
    • ►  December (1)
    • ►  September (1)
Awesome Inc. theme. Powered by Blogger.