Lecture-2.1-C Variables and Data Type
Lecture-2.1-C Variables and Data Type
Topics
• What is Variable
• Naming Variables
• Declaring Variables
• Using Variables
• The Assignment Statement
• C is case sensitive
o It matters whether an identifier, such as a
variable name, is uppercase or lowercase.
o Example:
area
Area
AREA
ArEa
are all seen as different variables by the
compiler.
CMSC 104, Version 9/01 7
Which Are Legal Identifiers?
AREA area_under_the_curve
3D num45
Last-Chance #values
x_yt3 pi
num$ %done
lucky***
garbage
FE07
CMSC 104, Version 9/01 10
More About Variables
diameter
float diameter = 5.9 ; 5.9
initial
char initial = ‘A’ ; ‘A’
return 0 ;
}