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
Difference between goto, long jmp() and setjmp()?
What does sizeof return c?
what value is returned to operating system after program execution?
how many key words availabel in c a) 28 b) 31 c) 32
in any language the sound structure of that language depends on its a) character set, input/output function, its control structures b) character set, library functions, input/output functions its control structures c) character set, library functions, control sturctures d) character set, operators, its control structures
What is the use of linkage in c language?
What is header file in c?
Explain what is meant by high-order and low-order bytes?
if p is a string contained in a string?
hi, which software companys will take,if d candidate's % is jst 55%?
How does placing some code lines between the comment symbol help in debugging the code?
write a program to print the consecutive repeated character from the given string... input string is : hhhhjkutskkkkkggggj output should be like this: hhhhkkkkkgggg anyone help me...
How can I direct output to the printer?
what are the advantages of a macro over a function?
How do I send escape sequences to control a terminal or other device?