{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lecture041 if-else - Other Types Of Data Variables of type...

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

View Full Document Right Arrow Icon
Lecture 7 -- 1 Computer Science I - Martin Hardwick Other Types Of Data Variables of type short use half a word (16 bits) to represent a value. everything else is the same as int range of values: -32,768 through 32,767 Variables of type float use one word (32 bits) to represent a value instead of the two used by a double. the extra bits are taken from the mantissa (number of  digits) A float has about 7 digits of accuracy A double has about 14 digits of accuracy Both can represent the same huge range (exponent)
Background image of page 1

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

View Full Document Right Arrow Icon
Lecture 7 -- 2 Computer Science I - Martin Hardwick More types An unsigned integer does not use a bit for the sign. An unsigned integer can be slightly larger than an integer but cannot be negative unsigned positive; A character variable is used to store a single character char letter = ‘A’; Like float and short, char variable is not used much anymore. We will use it occasionally. Instead we use String objects (much more on this later).
Background image of page 2
Lecture 7 -- 3 Computer Science I - Martin Hardwick Types we use Integer for ordinary numbers Double for floating points numbers String for string data (more later) Bool for logical values (more later) And in a few lectures we will begin to define our own data types. The types provided by the language are also known as the primitive types The types that we define are also known as defined types.
Background image of page 3

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

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}