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 / 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 |
Post New Answer View All Answers
an expression contains relational operators, assignment operators, and arithmatic operstors. In the absence of parentheses, they will be evaluated in which of the following order a) assignment, relational, arithematic b) arithematic, relational, assignment c) relational, arithematic, assignment d) assignment, arithematic, relational
Explain what is a 'locale'?
What is extern variable in c with example?
What is p in text message?
How can I pad a string to a known length?
What is operator promotion?
Differentiate fundamental data types and derived data types in C.
What is self-referential structure in c programming?
Explain b+ tree?
How can I remove the trailing spaces from a string?
What is main function in c?
What is volatile c?
Differentiate between the expression “++a” and “a++”?
Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.
main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }