Set type

Kenneth Almquist ka at hou3c.UUCP
Wed Feb 20 07:43:56 AEST 1985


Creating sets in C is easy.  To declare set element, use #define:

	#define RED 01
	#define BLUE 02
	#define GREEN 04

C has a union operator ("|"), an intersection operator ("&"), and even
a set difference operator ("&~").  Of course, this approach limits you
to sets which contain no more elements than are contained in an integer,
but this limitation also tends to apply to PASCAL sets.

It may be fun to talk about set operators instead of bitwise operators,
but you aren't going to eliminate the existing bit operators from C,
and we certainly don't need *both* set operators and bit operators.
				Kenneth Almquist



More information about the Comp.lang.c mailing list