For the first o/p even though i save it like u have done then too it's
showing me an empty string .....
for 2nd as Vindya has stated it should give me error but my compiler is
showing me 30 as it's output(the ans shd be 25 if not error) ?
On Wednesday, 25 July 2012 20:42:56 UTC+5:30, deepikaanand 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
>
>>
On Wednesday, 25 July 2012 20:42:56 UTC+5:30, deepikaanand 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/-/fNnV9Hvd4bkJ.
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.