@saurabh singh
one lil addition make your code complete.
#include<stdio.h>
#include<conio.h>
int main()
{
char s[20],t[30],*p,*q;
scanf("%s",s);
p=s;
q=t;
while(*(++p)!='\0');
p--;
while(p!=s)
{
*(q++)=*(p--);
}
*(q++)=*(p--); // first character of string
*q='\0';
printf("%s",t);
getch();
return 0;
}
On May 28, 4:25 pm, saurabh singh <[email protected]> wrote:
> #include<stdio.h>
> int main()
> {
> char s[20],t[30],*p,*q;
> scanf("%s",s);
> p=s;
> q=t;
> while(*(++p)!='\0');
> p--;
> while(p!=s)
> {
> *(q++)=*(p--);
> }
> *q='\0';
> }
> Is this what you are looking for?
> I think an inplace solution is required?
>
> On Sat, May 28, 2011 at 4:10 PM, abc abc <[email protected]> wrote:
> > *Given an array of characters. How would you reverse it. ? How would you
> > reverse it without using indexing in the array.*
> > *
> > *
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group at
> >http://groups.google.com/group/algogeeks?hl=en.
>
> --
> Saurabh Singh
> B.Tech (Computer Science)
> MNNIT ALLAHABAD
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.