Reverse a string word by word??

Answer Posted / anand

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
clrscr();
char a[]="i am anand";

int x,len,y,z;
len=strlen(a);
z=len-1;
for(x=len-1;x>=0;x--)
{
if(a[x]==' '||x==0)
{
for(y=x;y<=z;y++)
{
printf("%c",a[y]);
}
z=x;
}
}
getch();

}

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the ternary tree?

593


How many data structures are there in c?

609


Some coders debug their programs by placing comment symbols on some codes instead of deleting it. How does this aid in debugging?

649


Array is an lvalue or not?

627


How can you increase the allowable number of simultaneously open files?

587






Explain main function in c?

616


What is a file descriptor in c?

555


Can we assign integer value to char in c?

609


what is the diffrenet bettwen HTTP and internet protocol

1383


Is c is a low level language?

555


What does static variable mean in c?

641


What does void main () mean?

720


What is the difference between fread and fwrite function?

629


PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE

1462


How do I use strcmp?

632