Path: utzoo!attcan!uunet!lll-winken!csd4.milw.wisc.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hplabs!hpfcdc!mike From: mike@hpfcdc.HP.COM (Mike McNelly) Newsgroups: comp.lang.c Subject: Re: How to do sets? Message-ID: <5080031@hpfcdc.HP.COM> Date: 17 Mar 89 16:43:07 GMT References: <518taylorj@yvax.byu.edu> Organization: HP Ft. Collins, Co. Lines: 23 > This may be a dumb question, but I haven't been able to find anyone yet who > could answer it... > Is there a way to do sets in C (like in Pascal)? That is, check for set > inclusion (char in ["0".."9"]), and perform unions and intersections. And the > answer is not "use bitwise operators," I already know how to do that and would > rather not if there's an easier way, especially with large sets requiring 32 > bytes or more. > Thanks. No set operations are inherent in the C language. It's easy enough, however, to write a library with routines to 1) create a set of a specified size 2) manipulate the set (e.g. intersection) 3) free a set That's precisely how set operations are implemented in languages such as Pascal. Sorry, I can't provide such a library since it's part of our proprietary software. Mike McNelly mike%hpfcla@hplabs.hp.com