Passing types to a subroutine

Leslie Mikesell les at chinet.chi.il.us
Fri Nov 18 07:02:02 AEST 1988


>>	float	a[100];
>>	subroutine(...., a[100], ...);
>>	double	a[100];
>>	subroutine(...., a[100], ...);
>>and have the subroutine do the right thing with a[].

How about passing a struct containing a type code and pointers to
both types of arrays?  The "unused" item could be left null and
the type element would tell the function which pointer to use.

Les Mikesell



More information about the Comp.lang.c mailing list