0% found this document useful (0 votes)
3 views4 pages

Module 4 Data Types

The document provides an overview of data types in programming, explaining their classifications and uses. It covers basic data types such as integers, real numbers, strings, and special data types like arrays and pointers. The goal is to help learners identify and use appropriate data types in programming languages.

Uploaded by

shairalyn2010
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

Module 4 Data Types

The document provides an overview of data types in programming, explaining their classifications and uses. It covers basic data types such as integers, real numbers, strings, and special data types like arrays and pointers. The goal is to help learners identify and use appropriate data types in programming languages.

Uploaded by

shairalyn2010
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

10

Computer
Programming
Quarter I
Data Types

ii
Introduction:

A data type is a classification of data which tells the compiler or


interpreter how the programmer intends to use the data. Most
programming languages support various types of data, including integer,
real, character or string, and Boolean

After going through this module, you are expected to:

Identify the types and uses of different datatypes.

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

What is a Data Type


A Data Type is an attribute of data which tells the computer on how it will be
handled during execution.

Basic Data Types


1. The data that human beings use.
2. The data used solely by the computer and its I/O devices

As human beings, we are using two types of data:


1. Character data
2. Numeric data

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:

1. Strings - A string can consist of multiple words.


Represents a sequence of characters

Examples: “ Hello World ! “

2. Memo or Long Text Matter – Used to store documents or long explanations


inside a database.

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.

Computers subject numeric data to arithmetic manipulation, and it is possible to


perform all arithmetic operations on numeric data. Numeric data is further
classified into the following types:
1. Integers - Integers are whole numbers without any fractional part
Examples: -5,0,123
2. Real number - Real numbers are those that have a fractional part
Examples: -87.5, 0.0, 3.14159
3. Date - Dates contains three distinct parts, namely the day of the
month, the month, and the year.
4. Time – Time Contains three numbers for the hour, the minute, and
the second
5. Currency - A special number whose fractional part is restricted to 2
digits after the decimal point
6. Counters - integers and is used to count the number of iterations
7. Auto Incremented Number - These are used in database tables to
form a primary key for the table.

Special Data Types

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)

You might also like