Posts
 
Reputation
Joined
Last Seen
Ranked #928
Strength to Increase Rep
+3
Strength to Decrease Rep
-0
100% Quality Score
Upvotes Received
2
Posts with Upvotes
1
Upvoting Members
2
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
2 Commented Posts
0 Endorsements
Ranked #107.48K
~15.8K People Reached
Favorite Forums
Favorite Tags
c x 1
Member Avatar for johnray31

[QUOTE=jadavbheda;609850]But Why this works !!!!![/QUOTE] That works because foo's ptr, which is a local scope variable, is returned, which means the memory allocated for it won't get lost (it would still hold the correct value anyway, but this way we don't lose its address). However, you're not really modifying main's …

Member Avatar for Bharat_1
0
16K