Free
|
C language is a middle level language. It is a structured language. C language is a case sensitive language. All syntax written in c language is in lower case. C is the basis for C++.
|
|
|
|
|
C Program to sort the list of names of persons in alphabetical order using Bubble sort technique#include<stdio.h> #include<string.h> void main(void) { int i,k,n; char*name[50],*temp=""; printf("\nEnter number of persons:"); scanf("%d",&n); for(i=0;i<n;i++) gets(name[i]); for(k=0;k<(n-1);k++) { for(i=0;i<(n-k-1);i++) { if(strcmp(name[i],name[i+1]>0) { strcpy(temp,name[i]); strcpy(name[i],name[i+1]); strcpy(name[i+1],temp); } } } printf("\nSorted List..\n"); for(i=0;i<n;++i) puts(name[i]); }
COPYRIGHT 2009 ALL RIGHTS RESERVED FREECPROGRAMS.COM |
|