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 is meant by operator precedence?
What is the difference between mpi and openmp?
What is a pointer in c plus plus?
What are the standard predefined macros?
What do you mean by command line argument?
any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()
What are the valid places to have keyword “break”?
What is the use of f in c?
Is it fine to write void main () or main () in c?
What is the purpose of type declarations?
What is the difference between variable declaration and variable definition in c?
What are register variables in c?
What are the Advantages of using macro
Explain how do you search data in a data file using random access method?
What are the primitive data types in c?