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
How can type-insensitive macros be created?
What does %d do?
Is main a keyword in c?
Q.1 write a program to create binary tree 1 to 16 numbers? Q.2 write a program to creat a binary search tree for the member that is given by user?
which type of aspect you want from the student.
What is a structural principle?
Why c is called procedure oriented language?
What is null pointer constant?
Difference between Function to pointer and pointer to function
Explain how can you restore a redirected standard stream?
if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0
Who is the main contributor in designing the c language after dennis ritchie?
What is multidimensional arrays
What is the use of define in c?
What is the difference between printf and scanf )?