| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| 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™.