Interview Questions

Why aren't the sizes of the standard types precisely defined?

C Interview Questions and Answers


(Continued from previous question...)

Why aren't the sizes of the standard types precisely defined?

Though C is considered relatively low-level as high-level languages go, it does take the position that the exact size of an object (i.e. in bits) is an implementation detail. (The only place where C lets you specify a size in bits is in bit-fields within structures; Most programs do not need precise control over these sizes; many programs that do try to achieve this control would be better off if they didn't.
Type int is supposed to represent a machine's natural word size. It's the right type to use for most integer variables;

(Continued on next question...)

Other Interview Questions