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
Are bit fields portable?
Why is c not oop?
What is a scope resolution operator in c?
How many levels of indirection in pointers can you have in a single declaration?
What is n in c?
Can we add pointers together?
how to print the character with maximum occurence and print that number of occurence too in a string given ?
Process by which one bit pattern in to another by bit wise operation is?
write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?
A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers
Write a program to check palindrome number in c programming?
What is a MAC Address?
Is c dynamically typed?
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
How we can insert comments in a c program?