You are here:

C/Data Structure

Advertisement


Question
regarding 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.

Answer
Hi 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

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Prince M. Premnath

Expertise


I'm sure that I can solve any doubts in Turbo C ,Graphics Programing ,Mouse, Hardware Programming ,File System ,Interrupts, BIOS handling , TSR Programming , General Concepts in C Language, handling inline Assembly statements

Experience

Research over 6+ Years

Organizations
CG-VAK Softwares and Exports Limited

Education/Credentials
Masters in Computer Applications

©2012 About.com, a part of The New York Times Company. All rights reserved.