27 Reputation Points
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
0 Endorsements
Ranked #107.48K
Re: [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 … |