as per my knowledge
1)this is not swapping of the strings, use double indirection (use swap
function swap(char **t1, char **t2))
2)you cant change the address of the any array,(use change it to char
*t1="xyz",*t2="abc"; )

Thank you,
Sid.



On Wed, Sep 7, 2011 at 11:26 AM, piyush agarwal <pshagl...@gmail.com> wrote:

> #include<stdio.h>void swap(char *, char *);
> int main()
> {
>     char *pstr[2] = {"Hello", "piyush"};
>     swap(pstr[0], pstr[1]);
>     printf("%s\n%s", pstr[0], pstr[1]);
>     return 0;
> }void swap(char *t1, char *t2)
> {
>     char *t;
>     t=t1;
>     t1=t2;
>     t2=t;
> }
>
>
>
> --
> Piyush Agarwal
> Final Year Undergraduate
> Department of Computer Engineering
> Malaviya National Institute of Technology
> Jaipur
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to