-
Enum(s) and Memory
How does an enumerated data type use memory?
let's say i have
enum Family { brother, sister, mom, dad };
then i define it
Family intermediate;
How much space is set aside for intermediate?
And what's the difference/advantage of an enumerated data type and a whole bunch of ints?
-
>How much space is set aside for intermediate?
Code:
cout<< sizeof intermediate <<endl;
>And what's the difference/advantage of an enumerated data type and a whole bunch of ints?
An enumeration is more restrictive and provides more protection as a result. It also acts as documentation better than a "whole bunch of ints".
-
it says 4.. does this mean 4 bytes. type long?
-
>does this mean 4 bytes.
Yes.
>type long?
Does it matter?
-
Jeeze!! prelude!
thanks for answering me though