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
Why is a semicolon (;) put at the end of every program statement?
#define MAX(x,y) (x) >(y)?(x):(y) main() { inti=10,j=5,k=0; k= MAX(i++,++j); printf("%d..%d..%d",i,j,k); }
What are the 3 types of structures?
What is the difference between class and object in c?
Given below are three different ways to print the character for ASCII code 88. Which is the correct way1) char c = 88; cout << c << " ";2) cout.put(88);3) cout << char(88) << " "; a) 1 b) 2 c) 3 d) constant
Explain what are the different data types in c?
What does printf does?
What is the use of putchar function?
Explain what is the benefit of using an enum rather than a #define constant?
explain what is fifo?
What is unary operator?
A collection of data with a given structure for excepting storing and providing on demand data for multiple users a) linked list b) datastructer c) database d) preprocessor
How variables are declared in c?
What are logical errors and how does it differ from syntax errors?
How many levels of indirection in pointers can you have in a single declaration?