Module 4 Data Types
Module 4 Data Types
Computer
Programming
Quarter I
Data Types
ii
Introduction:
Sub-Task:
a. Understand the concept of data types in Programming Languages;
b. discuss the need to use data type in declaring a variable;
c. use appropriate data type in a given variable.
Definition of Terms:
Boolean
A data type representing logical true or false.
data type
Defines a set of values and a set of operations that can be applied on those
values.
floating point
A data type representing numbers with fractional parts.
integer
A data type representing whole numbers.
string
A data type representing a sequence of characters
Learn
Character Data
Character data includes any character that can be input to the computer. It can be
anything accepted by the computers. Character data is usually defined as a string
of words. A word is a contiguous set of characters and a string is a combination of
multiple words. Character data is generally used as:
3. Special Strings - The URLs (Uniform Resource Locators) used for website
addresses and email addresses form part of this data type.
Numeric Data
Numeric data is numbers expressing the value of some attribute of an entity.
There are data types that are used for special purposes in programs,
especially in developing system software.
1. Arrays - Arrays are tables of data. Usually, arrays are used in solving
mathematical problems in matrix algebra.
2. Pointers - Pointers are a special type of integer data. Pointers can
hold the address of any location inside the RAM.
3. Union - Union is a special data type used in the C family of
programming languages.
4. Boolean - This data has only two states, namely, 0 (true or yes) or 1
(false or no)