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)
|