ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> Programming Languages >> C
 
 


 

 
 C interview questions  C Interview Questions (2254)
 C++ interview questions  C++ Interview Questions (1111)
 VC++ interview questions  VC++ Interview Questions (342)
 Delphi interview questions  Delphi Interview Questions (510)
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions (646)
Question

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
 Question Submitted By :: C
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
its working but not correct. 
Is This Answer Correct ?    6 Yes 0 No
Chumurva
 
Answer
# 2
Then which one is the answer. i think the above one works
perfectly and they both will yield you the same results
which you wanted.

is this a tricky qustion? if so whats the answer for this
 
Is This Answer Correct ?    2 Yes 3 No
Naveen
 
 
 
Answer
# 3
#include <stdio.h>

int main()
{
char arr[100];
int count =0;
int j,i,k;
char temp;
printf("enter the string\n");
gets(arr);
for(i=0;arr[i]!='\0';i++)
count++;
printf("value of count is %d\n",count);
for(k=0;k<=count;k++)
{
for(j=0;j<count-1;j++)
{
if(arr[j]>arr[j+1])
{
temp=arr[j];
arr[j]=arr[j+1];
arr[j+1]=temp;
}

}
}
puts(arr);
return 0;
}

This is the correct and working program.
 
Is This Answer Correct ?    5 Yes 19 No
Yogesh Bansal
 
Answer
# 4
#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 ?    0 Yes 23 No
Vignesh1988i
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
write a program to find the largest and second largest integer from an array Value-Labs 2
Fifty minutes ago if it was four times as many mints past 3 o clock. how many minutes is it to six o'clock n how....????? TCS 3
write a string copy function routine?   2
#include<stdio.h> void main() { int a,b,c; a=b=c=1; c=++a || ++b && ++c; printf("%d\t%d\t%d",a,b,c); }   3
which is the best site or book for learning C...and i need the content for C..how to get the good programming skills....? can plz suggest me....   2
There are 21 people in a room. They have to form groups of 3 people each. How many combinations are possible? Write a C program to print the same. iGate 1
write a progam to display the factors of a given number and disply how many prime numbers are there?   2
I didn't count the ducks that I saw in line, but I do remember that one duck was in front of two ducks, another duck behind two ducks. How many ducks did I see?   2
when user give a number it multiply with 9 without useing '+' and '*' oprator   4
How to swap 3 numbers without using 4th variable?   5
Write a program that takes a 5 digit number and calculates 2 power that number and prints it.   1
what is the full form of c language Satyam 8
 
For more C Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com