TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: PAUL DRUGGITT
from: JAVIER KOHEN
date: 1997-05-28 20:01:00
subject: passing structures to functions

Javier Kohen to Druggitt. Ensign:
On stardate 16-May-97, Paul Druggitt established a sub-space link to All
refering to passing structures to functions.
 PD>  Can anyone tell me how to pass structures of different sizes to a
 PD>  function ?
 PD>  I have tried to pass a void pointer to my function, but cannot access
 PD>  individual members of the structure to perform comparisons.
Have you tried casting???
Ie:
struct Some {
        int any;
};
int foo(void *bar)
{
        return ((Some *) bar)->any; /* You can replace that cast with
        the corresponding new C++ cast, that I don't remember ;) */
}
Internet: jkohen@tough.com * Fidonet: 4:900/748.3 * Sk-Network: 200:201/201.2
                          -=[ PGP keyID 3423EAA9 ]=-
... Don't repeat your parents mistakes: use a condom!
-!- CrusherTag 0.02.
--- Terminate 4.00/Pro
4:900/748.3)
---------------
* Origin: The King of The Ring BBS þ +54-1-OFF-LINE þ TLD 0 - 7

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