DataType - Fundamental Data Types 1 Declaration All...

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

View Full Document Right Arrow Icon
1 Fundamental Data 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
2 Declaration All variables must be declared before being used. Tells compiler to set aside an appropriate amount of space in memory to hold a value . Enables the compiler to perform operations using the declared variables.
Background image of page 2
3 Basic Data Types char character int integer float floating-point double double floating-point void valueless
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 Modifying the Basic Types Type modifier : signed unsigned long short When a type modifier is used by itself, then int is assumed. Modifier Same As signed signed int unsigned unsigned int long long int short short int
Background image of page 4
5 Data Type char Have Seen :Chars are treated as small integers & conversely small ints are treated as chars. char c = ‘a’; printf (“% c ”, c + 1) b printf (“% d ”, c + 2) 99 Each char variable stored in 1 Byte 8 Bits : 2 7 2 6 2 5 2 4 2 3 2 2 2 1 2 0 128 64 32 16 8 4 2 1 a 0 0 0 0 1 1 0 1
Background image of page 5

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

View Full DocumentRight Arrow Icon
6 String of binary digits are called bit strings . A bit string is interpreted as a binary number . b n b n-1 …… b 2 b 1 b 0 0 1 1 0 0 0 0 1 a This bit string has the value: 1 × 2 6 + 1 × 2 5 + 1 × 2 0 = 97
Background image of page 6
7 3 types : 1) char 2) unsigned char 3) signed char Each uses 1 Byte. Signed char - 128 to 127 Unsigned char 0 to 255
Background image of page 7

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

View Full DocumentRight Arrow Icon
INTEGERS : Include the natural counting numbers and their negatives. INTEGRAL DATA TYPES
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/08/2011 for the course CSCE 206 taught by Professor Hurley during the Spring '11 term at Texas A&M.

Page1 / 28

DataType - Fundamental Data Types 1 Declaration All...

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

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