C/Data Structure
Expert: Prince M. Premnath - 11/18/2009
Questionregarding the program ask by mazlee for reverse string, i try to run the program, result sorting follow alphabet but the 'END' command appear between the string..........pls assist,tq.
AnswerHi Dear Ram !
Sorry for the delay in responding please find the code below
#include<stdio.h>
#include<conio.h>
#include<string.h>
char Names[10][20];
void main()
{
char Temp[20];
int i,j;
int n = 5;
for( i = 0 ; i <n; i++)
gets(Names[i]);
for( i = 0; i<n ; i++)
{
for(j=0; j< n-1; j++)
{
if( strncmp(Names[j], Names[j+1],1) > 0 )
{
strcpy(Temp,Names[j]);
strcpy(Names[j],Names[j+1]);
strcpy(Names[j+1],Temp);
}
}
}
for( i = 0 ; i< n ; i++)
puts(Names[i]);
getch();
}
Note; I havn't tested this programme , if you found any bugs please report to me ;) , make sure mark your questions as private if you wish to have in regular touch with me , get back to me if you have any doubts.
Feel free to text me
Thanks and Regards
Prince M. Premnath