I want to know how to announce int to make sure it’s 4 bytes or short in 2 bytes no matter on what platform. Does C99 have rules about this?
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.
C99 doesn’t say much about this, but you can check whether
sizeof(int) == 4, or you can use fixed size types like uint32_t (32 bits unsigned integer). They are defined instdint.h