TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: KEVIN YOCHUM
from: MATHIEU BOUCHARD
date: 1997-08-09 21:49:00
subject: Conversion of pointer

 KY>  This was taken out of context.  It made a lot more sense in the 
 KY>  original post, however...
 KY>> void test( int i )
 KY>> {
 KY>> i=5;
 KY>> return;
 KY>> }
 KY>> You're not getting a pointer back,
 CD>> You aren't getting anything back!!
 KY>  Sure you are!   You're getting the modified value of i.  In the above,
 KY>  i would be an "in/out" parameter.
void test (int& i) { i=5; return; }  /* C++: call is test(blah); */
and
void test (int* i) { *i=5; return; } /* C: call is test(&blah); */
these two get the modified value of i. The above one doesn't. parameter
passing in C is one-way, "by value", by passing only copies, not the
original.
matju
--- Terminate 4.00/Pro
---------------
* Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42)

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