I want to have a typedef that is 1-bit integer, so I though of this typedef int:1 FLAG; but I’m getting errors with it, is there a way I can do so?
Thanks
I want to have a typedef that is 1-bit integer, so I though of
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.
The smallest addressable “thing” in a C Program is a byte or
char.A
charis at least 8 bits long.So you cannot have a type (or objects of any type) with less than 8 bits.
What you can do is have a type for which objects occupy at least as many bits as a
charand ignore most of the bitsYou can see the code above running at ideone.