TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: BRIAN WOOD
from: DARIN MCBRIDE
date: 1998-01-31 11:18:00
subject: returning char. after delete[]

 BW> char *FuncToGetSomeString( int len )
 BW> {
 BW>    char *psz = new char[len];
 BW>    strcpy( psz, "Should I Do This???" );
 BW>    delete[] psz;
 BW>    return psz;
 BW> }
You are returning memory that is no longer owned by your program.  No, you 
should not do this.
---
---------------
* Origin: Tanktalus' Tower BBS (1:250/102)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.