Professional Documents
Culture Documents
Data Types Primitive Data Types
Data Types Primitive Data Types
• Data Types
• Type checking
• Operations
• Arithmetic
Float point numbers
• Conditional
• Logical
C++ example:
enum colors {red, blue, green, yellow, black};
colors myColor = blue, yourColor = red;
myColor++ ; //possible
myColor = 4; //not possible, only possible in
case the right side had been cast to colors
type.
address(list[k]) = address(list[lower_bound]) +
((k - lower_bound) * element_size)
• In C, C++, and C#, records are supported with the struct data
type.
• Design issues
• Type checking.
int *ptr;
int count, init;
……
ptr = &init; //address
count = *ptr; //value
ptr + index;
(Association)
1. Binding of a variable (identifier) with its type: Compile
time.
2. Binding of a variable (identifier) with its value: Run-time,
value of variable can change at run-time.
3. Binding of a variable (identifier) with its location (relative
address): compile-time
4. Binding of relative address with physical address: run-
time: Logical memory to physical memory address
conversion is a run-time issue, actual memory location
is known at run-time.