Well here's my silly doubt..
Do i need to deallocate a return pointer...
Code:char* function() { char *temp; temp=new char[100]; \\ sometin return temp; }
I cannot deallocate it in the function itself... SHould i deallocate after the function call in the main.
Code:temp=function(); \\ considering temp is a pointer delete(temp); \\ do i need to do this
I am asking this because i have never deallocated this kind of pointer.. Is what i am doing wrong.. do i need to deallocate it .. if so what is the right method... (hope i am not balbbering)



LinkBack URL
About LinkBacks


