Tagged: sort character array

Sort character array in ascending order in C 7

C program to sort character array (string) in ascending order

Below is the simple C program that will accept the character string from the user, calculates the length of the string and performs sorting operation on the string. The program will sort the character array in ascending order and display the result string (character array). Here we go, #include<stdio.h> #include<conio.h> void main() { clrscr(); int i,j; char *arr; //accept character array string from user printf(“Enter character string: “); gets(arr); //get the length of array in the variable counter int counter = 0; while(arr[counter] != NULL){ counter = counter + 1; } //apply ascending sorting algorithm for(i=0; i<counter; i++) { for(j=i;...

FREE C Programming Cheatsheet

FREE C Programming Cheatsheet


Cheatsheet for a quick glance at C programming concepts and syntax

Thank you! Check you inbox and access your cheat-sheet