TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: PAUL DRUGGITT
from: KURT KUZBA
date: 1997-05-23 12:20:00
subject: passing structures to fun

PD>   Can anyone tell me how to pass structures of different
PD>   sizes to a function ?
PD>   Now, is it possible to write a single function that will
PD>   accept ANY structure as a parameter, stating which member
PD>   to compare?
PD>   I have tried to pass a void pointer to my function, but
PD>   cannot access individual members of the structure to
PD>   perform comparisons.
pd>...
   You function must have some means of knowing the size of the
structure and the data layout within it. A parameter list,
similar to a printf() format string would suffice.
However, since each struct must be defined within the program,
it would be much easier to simply construct your functions to
compare exactly what is required in each required instance.
Function overloading may be used to good purpose in this cause.
> ] People with glass heads shouldn't.. Ummm.. I forgot.........
---
---------------
* Origin: *YOPS ]I[* 3.1 GIG * RA/FD/FE RADist * Milwaukee, WI (1:154/750)

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