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
If fflush wont work, what can I use to flush input?
Why is c called c?
What is the difference between near, far and huge pointers?
Is file a keyword in c?
Why c is called procedure oriented language?
Can I initialize unions?
Is return a keyword in c?
What are the disadvantages of external storage class?
What is an array? What the different types of arrays in c?
Explain how can I write functions that take a variable number of arguments?
Write a c program to build a heap method using Pointer to function and pointer to structure ?
cavium networks written test pattern ..
which type of aspect you want from the student.
What is define directive?
What is the size of empty structure in c?