--> Paul Druggitt wrote to All <--
PD> Can anyone tell me how to pass structures of different sizes to a
PD> function ?
PD>
PD> I know how to pass a structure of a known size, e.g.
PD> ^^^^^^^^^^^^^^^
PD> Now, is it possible to write a single function that will accept
PD>ANY structure as a parameter, stating which member to compare?
PD>
PD> eg.
PD>
PD> int main(void)
PD> {
PD>
PD> display_data(&DATA, DATA.type);
PD> display_data(&BIGGER_DATA, BIGGER_DATA.type);
PD>
PD> return(0);
PD> }
PD>
PD>
PD> I have tried to pass a void pointer to my function, but cannot
PD>access individual members of the structure to perform comparisons.
If you can do what you want in the function with just one structure
member, why do you need to pass the entire struct? Just pass the
member. Or am I missing something in your question?
Cliff Rhodes
cliff.rhodes@juge.com
X CMPQwk 1.42 1692 X"Man's speech is like his life." - Plato
--- Maximus/2 3.01
---------------
* Origin: COMM Port OS/2 juge.com 204.89.247.1 (281) 980-9671 (1:106/2000)
|