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 / atul kumar rai

#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
char str[100],temp1;
int i,j,len,temp;
printf("Enter any string : ");
gets(str);
len=strlen(str);
for(i=0,j=len-1;i<j;i++,j--)
{
temp1=str[i];
str[i]=str[j];
str[j]=temp1;
}
for(i=0; str[i]!=NULL; i++)
{
if(str[i+1]==' ' || str[i+1]==NULL)
{
for(temp=i; temp>=0 && str[temp]!=' '; temp--)
printf("%c",str[temp]);
printf(" ");
}
}
getch();
return 0;
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program to reverse a given number in c?

1075


Can we add pointers together?

1113


what is the structure pointer?

2175


How to establish connection with oracle database software from c language?

2255


Is there a built-in function in C that can be used for sorting data?

1338


in iso what are the common technological language?

2161


How do you determine the length of a string value that was stored in a variable?

1170


cavium networks written test pattern ..

4138


Can stdout be forced to print somewhere other than the screen?

1088


Tell me when would you use a pointer to a function?

1118


What is the use of a conditional inclusion statement in C?

1106


How can I get back to the interactive keyboard if stdin is redirected?

1231


What is class and object in c?

1172


What are the benefits of organizational structure?

1063


What is the advantage of using #define to declare a constant?

1155