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;
}

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

How will you declare an array of three function pointers where each function receives two ints and returns a float?

1079


What is graph in c?

819


Can two or more operators such as and be combined in a single line of program code?

1122


What are integer variable, floating-point variable and character variable?

869


Explain the difference between getch() and getche() in c?

749


Is null equal to 0 in sql?

873


What functions are in conio h?

899


what is different between auto and local static? why should we use local static?

885


What is a constant and types of constants in c?

846


What is an auto variable in c?

976


A c program to display count values from 0 to 100 and flash each digit for a secong.reset the counter after it reaches 100.use for loop,. pls guys hepl me.. :(

2009


Explain what does the function toupper() do?

843


What is enumerated data type in c?

854


a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list

842


A program is required to print your biographic information including: Names, gender, student Number, Cell Number, line of study and your residential address.

1483