Data Types in Computer Science Understanding basic, derived, and abstract data types
What are Data Types? Definition: Classification of data that tells compiler or interpreter how the data will be used. Importance: Ensures correctness, memory efficiency, and program clarity.
Categories of Data Types Primitive: int, char, float, double, boolean Derived: arrays, pointers, structures, unions Abstract: classes, objects, interfaces
Primitive Data Types in C int: typically 4 bytes, range -2,147,483,648 to 2,147,483,647 char: 1 byte, range -128 to 127 or 0 to 255 float: 4 bytes, 6-7 decimal digits double: 8 bytes, 15-16 decimal digits boolean: true/false values
Primitive Data Types in Python Python is dynamically typed: int: arbitrary precision float: 64-bit floating point bool: True or False str: text data list, tuple, dict as built-in collections
Code Examples C Example: int age = 25; float salary = 4500.50; Python Example: age = 25 salary = 4500.50
Summary Data types define how data is stored and processed. Choosing correct types improves efficiency and reduces errors.