for the first, p2 has moved beyond null character, so do char *c=p and
then print string for c.
for second , since the same object is modified more than once between
two sequence points, so it gives  compiler dependent answer.if it wud
have been i++||i++ , then the answer would have been defined as || is
a sequence point.

On Wed, Jul 25, 2012 at 8:42 PM, deepikaanand <swinyanand...@gmail.com> wrote:
> for the first o/p qs
> as p1 is moving towards the NULL('\0') character so is p2...to avoid dis
> save the base address and den let p2 move forward with p1
>
>
> char *p1="Name";
> char *p2;
> p2=(char *)malloc(20);
> char *save;
> save = (char *)malloc(20);
> save = p2;
> if(p2==NULL)
> cout<<"\n NOT ENOUGH SPACE";
> else
> {
>
> while(*p2++=*p1++);
>
> printf("%s\n",save);
> }
>
> for the second qs o/p = 25
> cz post incr means first use den incr  thererfore 5*5
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/lOll02QN_pwJ.
>
> 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.



-- 
Vindhya Chhabra

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