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...

Reverse a string word by word??

Answer Posted / rohit_kamlakar

#include<iostream.h>
#include<string.h>
#include<stdio.h>
#include<conio.h>
void main()
{
int length,i,j;
char string[500];clrscr();
printf("Enter the string=");
gets(string);
length=strlen(string); int y=length,z=0;
for(i=length-1;i>=0;i--)
{
if(int(string[i])==32)
{ printf(" ");
for(j=i+1;j<length;j++)
{
printf("%c",string[j]);
z++;
}
length=y-z;
}

if(i==0)
{ j=i; printf(" ");
while(int(string[j])!=32)
{
printf("%c",string[j]);

j++;
}
}

}
getch();
}

Is This Answer Correct ?    3 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you search data in a data file using random access method?

1255


What is the difference between variable declaration and variable definition in c?

1015


what is a NULL Pointer? Whether it is same as an uninitialized pointer?

1212


What is a char in c?

931


Write a program to produce the following output: 1 2 3 4 5 6 7 8 9 10

15728


Explain how can type-insensitive macros be created?

954


What is the difference between call by value and call by reference in c?

1115


What does dm mean sexually?

1261


What is the purpose of the preprocessor directive error?

1199


how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?

1920


What do you mean by a local block?

1027


What is the difference between exit() and _exit() function in c?

1019


When was c language developed?

1141


Explain what is the general form of a c program?

1032


how many key words availabel in c a) 28 b) 31 c) 32

1011