On Wednesday, 25 July 2012 20:59:47 UTC+5:30, jatin wrote:
>
> 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) ?   
>
ahh..ther's sumthng wrong with my compiler .. wen am running it online it's 
givng me the correct answ. 

> 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/-/xmObT3iqWaQJ.
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