Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

If fflush wont work, what can I use to flush input?

1044


Why is c called c?

950


What is the difference between near, far and huge pointers?

1026


Is file a keyword in c?

883


Why c is called procedure oriented language?

995


Can I initialize unions?

984


Is return a keyword in c?

1028


What are the disadvantages of external storage class?

1003


What is an array? What the different types of arrays in c?

1100


Explain how can I write functions that take a variable number of arguments?

1027


Write a c program to build a heap method using Pointer to function and pointer to structure ?

4620


cavium networks written test pattern ..

4025


which type of aspect you want from the student.

2112


What is define directive?

1073


What is the size of empty structure in c?

1015