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

Are bit fields portable?

1116


Why is c not oop?

937


What is a scope resolution operator in c?

1216


How many levels of indirection in pointers can you have in a single declaration?

1046


What is n in c?

982


Can we add pointers together?

1019


how to print the character with maximum occurence and print that number of occurence too in a string given ?

2419


Process by which one bit pattern in to another by bit wise operation is?

1120


write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?

2084


A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers

1140


Write a program to check palindrome number in c programming?

976


What is a MAC Address?

1017


Is c dynamically typed?

1106


Draw a flowchart to produce a printed list of all the students over the age of 20 in a class .The input records contains the name and age of students. Assume a sentinel value of 99 for the age field of the trailer record

5162


How we can insert comments in a c program?

1084