By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,035 Members | 1,064 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,035 IT Pros & Developers. It's quick & easy.

size of the data types.

P: 25
Is it the compiler that determines the size of the data types (e.g an int is of 2 bytes or of 4 bytes ) or does it depends on the computer's hardware that shall determine the size of the data types.
Sep 2 '09 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 2,404
The C Standard speciifes minimum sizes for the integral types. It also specifies relative size, for instance, sizeof(long) must be greater than or equal to sizeof(int).

The person who implements a particular C compiler has freedom to set the type sizes to anything that satisfies the restrictions imposed by the Standard. However, if the compiler author wants to sell many copies of that compiler then the type sizes will bear some relation to the intrinsic data types supported by the processor.
Sep 3 '09 #2

Banfa
Expert Mod 5K+
P: 8,916
It should also be noted that it is not only the size in terms of bytes in an integer that is Compiler/platform defined but also number of bits in the byte.

That said I have never worked on a platform that did not have 8 bits in its byte although I am reliably told that platforms with both 7 bits in the byte and 9 bits in the byte have existed.
Sep 3 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.