Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Do array subscripts always start with zero?

1295


What is function definition in c?

1077


Explain the difference between structs and unions in c?

1017


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?

2118


Can you tell me how to check whether a linked list is circular?

1406


Which one would you prefer - a macro or a function?

1074


Is fortran faster than c?

1034


How can you read a directory in a C program?

1141


Explain 'bus error'?

1085


How will you divide two numbers in a MACRO?

1129


What is the translation phases used in c language?

1119


How many levels of pointers have?

1040


Write a code to determine the total number of stops an elevator would take to serve N number of people.

1255


How to create struct variables?

1103


What is meant by keywords in c?

1068