Professional Documents
Culture Documents
C Programming - Expressions
C Programming - Expressions
C Programming
2. Expressions
Contents
● char
● int
● float
● double
● void
3
Modifying the Basic Types
● signed
● unsigned
● long
● short
4
Table 2-1. All Data Types Defined by the C
Standard
5
Table 2-1. All Data Types Defined by the C
Standard (cont.)
6
Identifier Names
7
Variables
8
Where Variables Are Declared
9
Local Variables
10
Formal Parameters
11
Global Variables
12
13
The Four C Scopes
● File scope
● Block scope
● Function prototype Scope
● Function scope
14
Variable Initializations
15
Constants
● Constants refer
to fixed values
that the
program may
not alter.
16
Operators
● Arithmetic
● Relational
● Logical
● Bitwise
17
The Assignment Operator
● variable_name = expression;
● When variables of one type are mixed with variables of another
type, a type conversion will occur.
18
19
Compound Assignments
20
Arithmetic Operators
21
Arithmetic Operators
22
The Precedence of the Arithmetic Operators
23
Relational and Logical Operators
24
Relational and Logical Operators
25
Bitwise Operators
26
Expressions
27
Order of Evaluation
28
Type Conversion in Expressions
29
A Type Conversion Example
30
Casts
31