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

What is #include called?

670


what are the different storage classes in c?

754


What is wrong with this statement? Myname = 'robin';

925


how can I convert a string to a number?

688


What is null pointer constant?

704






What are the characteristics of arrays in c?

699


What will the preprocessor do for a program?

661


Tell me can the size of an array be declared at runtime?

680


what are the advanced features of functions a) function declaration and prototypes b) calling functions by value or by reference c) recursion d) all the above

771


What are the 5 types of organizational structures?

659


What is the purpose of macro in C language?

748


What is the difference between formatted&unformatted i/o functions?

713


The difference between printf and fprintf is ?

803


What does 3 periods mean in texting?

691


What are header files in c programming?

744