Professional Documents
Culture Documents
Lec 5 Variable Datatypes
Lec 5 Variable Datatypes
1101
Structured Programming
Rafid Mostafiz
IIT-NSTU
Lecture Contents
2
Basic terms
Data type
Variables
Basic term
3
Tokens
In C programs, the smallest individual units are known
as tokens.
Basic term
4
A data type is
A set of values
A set of operations on those values
A data type is used to
Identify the type of a variable when the variable is
declared
Identify the type of the return value of a function
Identify the type of a parameter expected by a function
Data types
7
Pop quize
money$owed; (incorrect: cannot contain $)
total_count (correct)
score2 (correct)
2ndscore (incorrect: must start with a letter)
long (incorrect: cannot use keyword)
char (incorrect: cannot use keyword)
Variable Type
15
Example
int x; x=10;
int a,b; a=5;
float mmm; b=45;
mmm=3.50
It is also possible to assigned value to a variable using assigned (=) operator.
Example: int x=10;
19
Any Question?