Lecture4 - Other Types Of Data Variables of type short use...

Info iconThis preview shows pages 1–5. 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 DocumentRight 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. Good programming requires good data types
Background image of page 3

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

View Full DocumentRight Arrow Icon
Lecture 7 -- 4 Computer Science I - Martin Hardwick Converting between types For the primitive types conversion is usually implicit
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/08/2008 for the course CSCI 1100 taught by Professor Hardwick during the Fall '08 term at Rensselaer Polytechnic Institute.

Page1 / 11

Lecture4 - Other Types Of Data Variables of type short use...

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

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