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

Why do we need arrays in c?

1155


What are the advantages of using linked list for tree construction?

1087


What is || operator and how does it function in a program?

1086


What is New modifiers?

1126


Difference between constant pointer and pointer to a constant.

1140


How will you find a duplicate number in a array without negating the nos ?

2135


Write a program to print ASCII code for a given digit.

1091


Why & is used in scanf in c?

1100


can any one tel me wt is the question pattern for NIC exam

1972


What is wild pointer in c with example?

1060


What is %lu in c?

1256


5 Write an Algorithm to find the maximum and minimum items in a set of ā€˜n’ element.

2109


Why doesnt this code work?

1058


What is #include stdio h and #include conio h?

1105


What is the heap?

1216