How about a Nibble etc.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No. Even if you have an array of Booleans, I believe they’re specified to take up one byte each.
Of course you can define your own data types which have fewer than 256 valid values (like
Booleandoes) but you can’t make it take up less than a byte in memory.As LBushkin pointed out, there are types such as
BitArrayandBitVector32which effectively pack multiple bits efficiently – you could write your ownNybbleArraytype if you wanted.