Unions
Clayton Cramer
cramer at optilink.UUCP
Fri Oct 21 03:35:43 AEST 1988
In article <322 at hrc.UUCP>, dan at hrc.UUCP (Dan Troxel VP) writes:
>
> Except for the memory savings, what are Unions suited for?
> --
> Dan Troxel VP of Computer Operations @
They can be useful for showing that several different possible alternatives
are just that -- alternatives. Consider:
union uTag
{
int CmdTblJumpIndex;
PFI FuncToExecute;
char* SystemCmdToRun;
} ActionToTake;
vs.
int CmdTblJumpIndex;
PFI FuncToExecute;
char* SystemCmdToRun;
The first example shows that all three are alternatives, and in fact,
if you tried to write code that used two of them at once, it wouldn't
work correctly.
--
Clayton E. Cramer
..!ames!pyramid!kontron!optilin!cramer
More information about the Comp.lang.c
mailing list