You can also free the memory of q , we don't need it anymore .
but , the code is just fine .

On Feb 13, 5:03 pm, dinesh bansal <bansal...@gmail.com> wrote:
> On Tue, Jan 11, 2011 at 10:14 PM, snehal jain <learner....@gmail.com> wrote:
> > what is the wrong in the program?
>
> > main()
> > {
> > char *p,*q;
> > p=(char *)malloc(25);
>
> Check for p against NULL.
>
> > q=(char *)malloc(25);
>
> Check for p against NULL.
>
> > strcpy(p,"amazon");
> > strcpy(q,"hyd");
> > strcat(p,q);
>
> compilation error
>
> > printf("%s"p);
>
> Free allocated memory.
>
> > }
>
> > --
> > 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.
>
> --
> Dinesh Bansal
> The Law of Win says, "Let's not do it your way or my way; let's do it the
> best way."

-- 
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