1. Introduction to Computers and
Programming (CSC241)
Lecture 01
Muhammad Raza Ul Islam
raza.islam@comsats.edu.pk
1
2. Examples...
•A sensor placed on the muscles is used to measure the activity in terms of pressure.
The pressure level is then further used to control a robot. Initially the robot is in rest
state, so as the muscle where the sensor is placed. Robot can left, right, forward and
backward when the value of the muscles activity is between 0.6-1, 1.1-1.5, 1.6-2 and
2.1-2.5. The scenario is that robot can execute these movements when the muscle
activity ones has gone above 3, which can be termed as trigger signal.
2
4. Data Types
Basic data types
4
Type Size range Description
int 4
bytes
-2147483647 … 2147483647 Stores whole numbers, without
decimals.
float 4
bytes
1.175494351 E – 38 …
3.402823466 E + 38
Stores fractional numbers, containing
one or more decimals.
double 8
bytes
2.2250738585072014 E – 308 …
1.7976931348623158 E + 308
Stores fractional numbers, containing
one or more decimals.
boolean 1 byte NA Stores true or false values.
char 1 byte NA Stores a single
character/letter/number, or ASCII
values.
string NA NA Stores sequence of characters in text
form.
5. Data Types
•Integers can be signed, unsigned, short, unsigned shoet, signed short,
long, signed long, unsigned long, long long and unsigned long long.
•Floats has 7 decimal digits of precision.
•Double has 15 decimal places of precision and there is another type
long double.
5