Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is wrong with this code such that it doesnt produce
the input reversed?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
char Space = ' ';
char LineOfText;
float count;

LineOfText = getchar();

while ((LineOfText = getchar()) != '/n');
{
count = strlen(LineOfText) - 1;
while (count >= 0)
{
putchar(LineOfText[count]);
count--;
}

}
getchar();
return 0;
}

Answers were Sorted based on User's Feedback



What is wrong with this code such that it doesnt produce the input reversed? #include <stdio.h..

Answer / ashok kumar

Actually the function strlen() returns an integer value,
but here we want to try to push that value to the float
variable. To rectify this problem declare the variable
"count" as int.

Is This Answer Correct ?    1 Yes 0 No

What is wrong with this code such that it doesnt produce the input reversed? #include <stdio.h..

Answer / sanjay bhosale

LineOfText is not an array of characters.
first while loop only stores '/n' in lineOfText.
We cant apply strlen on character we should pass the address of character array to it.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

How are portions of a program disabled in demo versions?

0 Answers  


What are local and global variables?

3 Answers  


write a c program to print the next of a particular no without using the arithmetic operator or looping statements?

1 Answers   TCS,


How is a two dimensional array passed to function when the order of matrix is not known at complie time?

1 Answers   CSC,


Where is volatile variable stored?

0 Answers  


Explain logical errors? Compare with syntax errors.

0 Answers  


hi to every one .. how to view table pool after creating the pooled table? plz help me.. if any knows abt this ..

0 Answers  


mplementation of stack using any programing language

1 Answers   Marlabs,


In c language can we compile a program without main() function?

0 Answers  


What are the benefits of c language?

0 Answers  


application attempts to perform an operation?

0 Answers  


plz answer..... a program that reads non-negative integer and computes and prints its factorial

2 Answers  


Categories