TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: CHRISTIAN S. PEDERSEN
from: ROGER SCUDDER
date: 1997-07-26 14:23:00
subject: Re: Conversion of pointer.

>Behold, a function which returns a pointer:
 
>int* test()
>{
>    int i=5;
>    return &i;
>}
 
Don't do this... returning the address of an auto variable
is asking to get clobbered.   
Roger
--- AdeptXBBS v2.14(WC) (*FREEWare/2*)
---------------
* Origin: The Cereal Port BBS 603-899-3335 199.125.78.133 (1:132/152)

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™.