SCHOOL OF CODE BUILDERS
Learn To CODE. Become A DEVELOPER.
Pages
HOME
DATA STRUCTURES
STRINGS
ARRAYS
MATRIX
BINARY TREES
LINKED LIST
STACK
QUEUE
SORTING
SEARCHING
C
PYTHON
PSEUDOCODE
CONTEST PROBLEMS
ALGORITHMS
PATTERNS
PHP
C PUZZLES
C INTERVIEW QUESTIONS
JAVA
C++
HASHING
RECURSION
BASIC C PROGRAMS
TCS-CODEVITA
FACEBOOK
CONTACT US
C program to arrange names in alphabetical order
C program to arrange names in alphabetical order
Output:
How many words to sort ?
6
Enter the strings:
acb
bac
bca
cab
cba
abc
The sorted names are:
abc
acb
bac
bca
cab
cba
Implementation:
#include
#include
#include
int main(void) { char s[1000][1000],temp[1000000]; int n,i,j; printf("How many words to sort?\n"); scanf("%d",&n); printf("Enter the strings:\n"); for(i=0;i
0) { strcpy(temp,s[i]); strcpy(s[i],s[j]); strcpy(s[j],temp); } } } printf("The sorted names are:\n"); for(i=0;i
PREVIOUS
NEXT
HOME