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

What is zero based addressing?

1110


If null and 0 are equivalent as null pointer constants, which should I use?

1120


How to declare pointer variables?

1165


What are global variables and explain how do you declare them?

1030


What are volatile variables in c?

888


#include { printf("Hello"); } how compile time affects when we add additional header file .

1852


p*=(++q)++*--p when p=q=1 while(q<=6)

1698


What are the __date__ and __time__ preprocessor commands?

1040


a program that can input number of records and can view it again the record

1864


Explain 'bus error'?

1014


What is character constants?

1131


What does & mean in scanf?

1043


How do you declare a variable that will hold string values?

1104


What is a structural principle?

1090


Is there any data type in c with variable size?

1033