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

pgm in c to reverse string by word using array(god is love
becomes love is god)
(no additional array can used,space is only delimiter
between words )

Answer Posted / vaibhav srivastava

#include<stdio.h>

int main()
{
char str[50];
int i,j,k;
printf("\nEnter the string\t");
fflush(stdin);
gets(str);
puts(str);

for (i=0; str[i]!='\0';i++);
for ( k=i; k>0; k--)
{ if ( str[k]==' ' || k==i)
{ for( j=k-1; (str[j]!=' ') && (j!=-1) ;j--);
{
while ( ++j!=k)
{printf("%c", str[j]);}
printf(" ");


}


}


}

printf("\n");

}

Is This Answer Correct ?    22 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

"%u" unsigned integer print the a) address of variable b) value of variable c) name of a variable d) none of the above

1028


where are auto variables stored? What are the characteristics of an auto variable?

1076


What does the error 'Null Pointer Assignment' mean and what causes this error?

1230


What are inbuilt functions in c?

1038


Can the size of an array be declared at runtime?

1090


What is null pointer in c?

1002


What is c mainly used for?

1069


Differentiate between a structure and a union.

1296


What are the rules for the identifier?

1171


What are the different categories of functions in c?

1138


What is union and structure in c?

1234


Write an efficient algo and C code to shuffle a pack of cards.. this one was a feedback process until we came up with one with no extra storage.

1069


What's a good way to check for "close enough" floating-point equality?

1170


Is swift based on c?

1111


How to declare a variable?

1014