Reverse a string word by word??

Answer Posted / vignesh1988i

#include<stdio.h>
#include<conio.h>
void main()
{
char a[40],temp;
int count=0;
printf("enter the string :");
gets(a);
for(int i=0;a[i]!='\0';i++)
count++;
for(i=0;a[i]!='\0';i++)
{
if(count>i)
{
temp=a[i];
a[i]=a[count-1];
a[count-1]=temp;
count--;
}
else
break;
}
printf("the reversed ones is : ");
puts(a);
getch();
}

thank u

Is This Answer Correct ?    9 Yes 21 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Tell me what is null pointer in c?

814


How many loops are there in c?

842


What is the meaning of && in c?

779


What does void main () mean?

982


What does c mean?

789


a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above

1162


What is the use of bitwise operator?

905


c program to compute AREA under integral

2109


How do you use a 'Local Block'?

960


What are different types of pointers?

804


what is the difference between 123 and 0123 in c?

971


What is a structure and why it is used?

888


What is const keyword in c?

977


An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array

942


What is the condition that is applied with ?: Operator?

910