in DS
230 views
0 votes
0 votes

Suppose in P3 the free statement was not present then P3 will not be creating any problem right because when i return p3 it will return basically what its pointing to which is dynamically allocated memory from heap which will be there even though px doesn't exist now that returned value can be stored in another pointer now Right ??

Right now P3 is the case of Dangling Pointer isn't it ?

in DS
by
230 views

2 Comments

Absolutely correct,
1
1
Yes, it won't create any problem.
0
0

Please log in or register to answer this question.

Related questions