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
Do array subscripts always start with zero?
What is function definition in c?
Explain the difference between structs and unions in c?
Q.1 write aprogram to stack using linklist o insert 40 items? Q.2 write a program to implement circular queue with help of linklist?
Can you tell me how to check whether a linked list is circular?
Which one would you prefer - a macro or a function?
Is fortran faster than c?
How can you read a directory in a C program?
Explain 'bus error'?
How will you divide two numbers in a MACRO?
What is the translation phases used in c language?
How many levels of pointers have?
Write a code to determine the total number of stops an elevator would take to serve N number of people.
How to create struct variables?
What is meant by keywords in c?