C Program To Sort Names

Write a C program to read N names, store them in the form of an array and sort them in alphabetical order.Output the given names and the sorted names in two columns side by side with suitable heading.Program will sort the name strings using Bubble Sort technique. Read more about C Programming Language .

* You can use all the programs on www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact [email protected]
* To find more C programs, do visit www.c-program-example.com
* and browse!
* Happy Coding

#include <stdio.h>
#include <conio.h>
#include <string.h>

void main()
char name[10][8], Tname[10][8], temp[8];
int i, j, N;


printf("Enter the value of Nn");
scanf("%d", &N);

printf("Enter %d namesn", N);
for(i=0; i< N ; i++)
strcpy (Tname[i], name[i]);

for(i=0; i < N-1 ; i++)
for(j=i+1; j< N; j++)
if(strcmpi(name[i],name[j]) > 0)

printf("Input NamestSorted namesn");
for(i=0; i< N ; i++)
printf("%stt%sn",Tname[i], name[i]);

} /* End of main() */
Read more Similar C Programs

Data Structures

C Sorting

You can easily select the code by double clicking on the code area above.

To get regular updates on new C programs, you can Follow @c_program

You can discuss these programs on our Facebook Page. Start a discussion right now,

our page!

Share this program with your Facebook friends now! by liking it

(you can send this program to your friend using this button)

Like to get updates right inside your feed reader? Grab our feed!

(c) www.c-program-example.com

Leave a Reply