Re: [algogeeks] Reverse the string word by word . Can someone tell what is wrong in my code ?

2011-09-25 Thread avinesh saini
Try this one... #includestdio.h #includestring.h void reverse(char *p,char*q) { char c; while(pq) { c=*p;*p=*q;*q=c; p++; q--; } } int main() { char A[50]; printf(\n Enter a String:\n\n); gets(A); int len=strlen(A);

[algogeeks] Reverse the string word by word . Can someone tell what is wrong in my code ?

2011-09-24 Thread Deoki Nandan
//Reverse String word by word // if string is :- I am a good boy //output string should be :- boy good a am I #includestdio.h #includestring.h void reverse(char *p,char*q) { int i;char c; while(pq) { c=*p;*p=*q;*q=c; p++; q--; } } void

Re: [algogeeks] Reverse the string word by word . Can someone tell what is wrong in my code ?

2011-09-24 Thread Dheeraj Sharma
u shud do TWO things in..your reverseword function.. first is str[i]=='\0' and not str[i]='\0' second is while(i=len) and not while(ilen) On Sun, Sep 25, 2011 at 6:49 AM, Deoki Nandan deok...@gmail.com wrote: //Reverse String word by word // if string is :- I am a good boy //output string