question about an array of enum

Tim Tsai it1 at ra.MsState.Edu
Sat Nov 3 19:53:50 AEST 1990


  consider the following code:

typedef enum {false, true} boolean;

main()
{
	boolean bit_fields[1000];

	bit_fields[0] = true;
}

  How much memory does bit_fields actually take up, assuming a 32-bit
architecture?  Will my C compiler treat it as an array of int's?
(Sun OS 4.1, Sun cc).  What about other C compilers?  (I know turbo C
has a switch that allows it to treat enum data types as int's).

  I thought about using an array of characters and calculate
the positions, but I'd rather use enum if possible.  It's quite a bit
simpler.

  Any help is greatly appreciated...

-- 
  Sometimes I think the surest sign that intelligent life exists elsewhere
  in the universe is that none of it has tried to contact us.
                                         <Calvin of Calvin & Hobbes>
  Disclaimer: I don't speak for ANYBODY but myself! <Me>



More information about the Comp.lang.c mailing list