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
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 |
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 |
What are the modifiers available in c programming language?
What are variables and it what way is it different from constants?
in b=6.6/a+(2*a+(3*c)/a*d)/(2/n); which operation will be performed first a) 6.6/a b) 2*a c) 3*c d) 2/n
main() { int i; printf("%d", &i)+1; scanf("%d", i)-1; }
What is a struct c#?
How to receive strings with spaces in scanf()
regarding pointers concept
#include<stdio.h> #include<conio.h> void main() { clrscr(); int a=0,b=0,c=0; printf("enter value of a,b"); scanf(" %d %d",a,b); c=a+b; printf("sum is %d",c); getch(); }
x=2,y=6,z=6 x=y==z; printf(%d",x)
13 Answers Bharat, Cisco, HCL, TCS,
Why enum is used in c?
Explain output of printf("Hello World"-'A'+'B'); ?
what is structuer?