The Integer Types - The Integer Types Objectives Understand...

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

View Full Document Right Arrow Icon
The Integer Types
Background image of page 1

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

View Full DocumentRight Arrow Icon
Objectives Understand how the integer types are used to represent numbers and non- numeric information Understand how the type defines the “interpretation” of the bits in a memory location Be ready for the pitfalls of C
Background image of page 2
Finiteness Never forget that there are a finite number of values any variable can take k -bits means no more than 2 k values roughly 256 char s, 64K short s, 4G int s The “number line” is a circle!
Background image of page 3

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

View Full DocumentRight Arrow Icon
Signed and Unsigned Any of the integer types can be modified with either signed or unsigned Default is signed except for char which has no default (it’s arbitrary) Signed means “interpret as two’s complement” Unsigned means “interpret as binary”
Background image of page 4
Overflow Overflow (or underflow) occurs when the (mathematical) result of a computation cannot be represented using the type defined e.g., the result of “100 + 100” cannot be represented in 8-bit two’s complement Puzzle: given the statement “z = x + y;” under what circumstances will the wrong value be calculated for z (i.e., when will it overflow)
Background image of page 5

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

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

This note was uploaded on 07/24/2010 for the course EE 312 taught by Professor Shafer during the Spring '08 term at University of Texas at Austin.

Page1 / 9

The Integer Types - The Integer Types Objectives Understand...

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

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