25_pdfsam_lecture2 - More on types I C also de nes type...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: More on types I C also de nes type quali ers that modify basic types I Short, long, unsigned, signed I Warning: meaning di ers between compilers and machines! Type Typical size Typical range char 1 byte [0, 256] signed char 1 byte [-128, 127] short int 2 bytes [-32768, 32767] int 4 bytes [-2,147,483,648, 2,147,483,647] unsigned int 4 bytes [0, 4,294,967,295] long long int 8 bytes [-9,223,372,036,854,775,808, 9,223,372,036,854,775,807] oat 4 bytes Approx. [1.40e-45, 3.40e+38] double 8 bytes Approx. [4.94e-324 to 1.80e+308] Variable declaration and initialization I C requires all variables to be declared before any other statements I Although this was relaxed in C99 standard int main() { ss int x = 1, y; ss int sum; ss y = 3; ss return 0; } int main() { ss int x = 1, y; ss y = 3; ss int sum; /*compiler error!*/ ss return 0; } I The initial value of a variable is unde ned int i; printf( %d\n , i); /* undefined behavior */ Other variable quali ers I extern : used to share variables across C source les...
View Full Document

Page1 / 6

25_pdfsam_lecture2 - More on types I C also de nes type...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online