Data Classification Presentation
Data Classification Presentation
Data Classification Presentation
Primitive
Composite
Primitive data type
Primitive data type
Primitive data type are predefined data types that contain simple
values of specific characteristics, such as numeric or textual and are
not based on any other type.
They are the most basic form and serve as a building block from
which other, more sophisticated types are built.
These data types are also known as simple data types because they
consist of characters that cannot be divided
Integer, character, bool, Null, etc are examples of primitive data type
Integer
A
!
Example in C
Char letter[] =‘a’;
Floating point & double
Long data types are often 32- or 64-bit integers in code. Sometimes, these can
represent integers with 20 digits in either direction, positive or negative.
Example:
-398,741,129,664,271
9,000,000,125,356,546
Short: Similar to the long data type, a short is a variable integer. Short stores
smaller ranges, using less memory,
Boolean
Example
int *ptr = NULL;
Composite data type
Composite data type
Struct Product = {
id: number;
name: string;
price: number;
};
Union
A union type contains a group of data objects that can have varied data types
(unlike arrays).
Unlike records, with unions, each object starts at the same memory location,
meaning the union variable can only store one value at a time.
When a new value is assigned to a field, the existing one is overwritten.
User-Defined Data Types (UDTs)
#include <stdio.h>
int main() {
int n = NULL;
n=‘ udsm’; //this will result to error as the reference of the data
type is static
return 0;
};
Python code (dynamic typing)
Example in Python
x = 10 # x is an integer
print(type(x)) # Output: <class 'int'>
x = "hello" # Now x is a string
print(type(x)) # Output: <class 'str'>
Data casting
Data casting
Is the process of automatically converting one data type into another data
type through conversion from smaller data type to a higher data type
Operators