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
Why doesnt that code work?
Is array name a pointer?
In C, What is the #line used for?
What are high level languages like C and FORTRAN also known as?
What is a buffer in c?
What is the meaning of c in c language?
Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix
How many levels of pointers can you have?
What is the difference between declaring a variable and defining a variable?
which is an algorithm for sorting in a growing Lexicographic order
What are the three constants used in c?
What is main () in c?
Describe the header file and its usage in c programming?
Why do we need arrays in c?
What is extern variable in c with example?