Lesson 3
Variables and Data Types
1. Variables and Data types
2. Integer Data Type
3. Floating Point Data Type
4. Character Data Type
5. Declaration of a Variable
6. Initialization of a Variable
7. User Defined Data Types
1. Variable and data types
A variable's type determines the values that the variable can have and the
operations that can be performed on it. For example, the declaration int count
declares that count is an integer ( int ). ... Primitive types contain a single value
and include types such as integer, floating point, character, and boolean.
2. Integer Data Type
In computer science, an integer is a datum of integral data type, a data type that represents
some range of mathematical integers. Integral data types may be of different sizes and may or
may not be allowed to contain negative values. Integers are commonly represented in a
computer as a group of binary digits (bits).
3. Floating Point Data Type
In computer science, a float is a data type composed of a number that is not an
integer, because it includes a fraction represented in decimal format. ... Some point out
that the float data type is used in computer programming when more precision is
needed than what integers can provide.