I need to take a sentence from input and sort the words
alphabetically using the C programming language.

Note: This is C not C++.
qsort and strtok not allowed

Answer Posted / vignesh1988i

#include<stdio.h>
#include<conio.h>
void main()
{
char a[50],temp;
int count=0;
printf("enter the string");
gets(a);
for(int i=0;a[i]!='\0';i++)
count++;
for(i=0;i<count;i++)
{
for(int j=0;j<count;j++)
{
if(a[j]=a[j+1];
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
printf("\n");
puts(a);
getch();
}

thank u

Is This Answer Correct ?    1 Yes 27 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

A SIMPLE PROGRAM OF GRAPHICS AND THEIR OUTPUT I WANT SEE WAHAT OUTOUT OF GRAPHICS PROGRAM

1681


The number of measuring units from an arbitarary starting point in a record,area,or control block to some other point a) recording pointer b) offset c) branching d) none

688


Is swift based on c?

620


Explain how can you restore a redirected standard stream?

573


What is the difference between void main and main in c?

605






Should I learn c before c++?

584


swap 2 numbers without using third variable?

648


Explain what is a stream?

594


Is c is a middle level language?

581


What is the use of #include in c?

566


Is fortran still used today?

588


Can we add pointers together?

604


What is the best way to store flag values in a program?

565


What is function pointer c?

575


What is multidimensional arrays

618