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
#include show(int t,va_list ptr1) { int a,x,i; a=va_arg(ptr1,int) printf(" %d",a) } display(char) { int x; listptr; va_star(otr,s); n=va_arg(ptr,int); show(x,ptr); } main() { display("hello",4,12,13,14,44); }
How to write c functions that modify head pointer of a linked list?
What is the use of bit field?
How can I swap two values without using a temporary?
Why is it usually a bad idea to use gets()? Suggest a workaround.
we called a function and passed something do it we have always passed the "values" of variables to the called function. such functions calles are called a) calls by reference b) calls by value c) calls by zero d) none of the above
What is function pointer c?
How can I invoke another program or command and trap its output?
Write an efficient algo and C code to shuffle a pack of cards.. this one was a feedback process until we came up with one with no extra storage.
What is the size of empty structure in c?
What are header files why are they important?
Write a program to swap two numbers without using third variable in c?
hi to every one .. how to view table pool after creating the pooled table? plz help me.. if any knows abt this ..
How can I pad a string to a known length?
What is an identifier?