Bits, Bytes And Data Types Flashcards
Bit
Smallest unit of memory which can hold a value of 0 or 1. (On or off lightswitch)
Memmory addresses
Sequential units where the memory is organized
Byte
Group of bits that are operated on as a unit, comprised of 8 sequential bits, a byte of data is stored in each memory address
Data types
How the compiler interpretes the contents of memory in some meaningful way (ex. Integers)
Fundamental data types
Also called basic, primitive, built-in are data types built in with support of c++
Integers
Specific data types that hold positive and negative whole numbers including 0
Integral types
Includes all boolean, characters and integer types, they are stored in memory as integers
_t suffix
Type, common nomenclature applied to modern types
Void
No type, variables can’t be defined with void type
Use of void
With
- functions that do not return a value
- functions that do not take parameters
For functions that have no paramethers
Use empty paramether list instead of void
Object sizes
Dependant on data types
Single bit
Can hold 2 possible values 0 or 1
Two bits
Can hold 4 possible values
Object with n bits
Can hold 2^n unique valies
Size of an object
Puts a limit on the amount of unique values it can store
Size of a given data type
Dependent on the compiler and/or the computer architecture
Sizeof operator
Unary operator that takes either a type or a variable and returns its size in bytes
Integer
Internal type that can represent positive, negative number and 0
C++ fundamental integer types
Short, int, long and long long
Difference between integer types
They have varying sizes, longer integers can hold big numbers
Numbers sign
Attribute of being positive, negative or zero
Defining signed integers
Short s, int i, long l, long long ll
Range
Set of specific values that a data type can hold