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
What are the advantages of c preprocessor?
What are the advantages of union?
Which is best linux os?
Is it fine to write void main () or main () in c?
What is variable initialization and why is it important?
Write a program of advanced Fibonacci series.
which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above
Do you know what are bitwise shift operators in c programming?
What is realloc in c?
What does d mean?
What is a function in c?
What is the function of this pointer?
Explain what are reserved words?
How do you determine the length of a string value that was stored in a variable?
What is malloc return c?