Ch#9 Lecture#7
Ch#9 Lecture#7
12
SUBJECT TEACHER:
RASHAD MAHMOOD
CMA (Managerial) MBA-IT & Business
Cisco Certified Network Administrator
(MS Access and C) Microsoft Certified System Engineer
Linux Operating System Certified
Comptia Computer Hardware Certified
• Compound Condition
• Logical Operators ( AND, OR & NOT)
• Operator Precedence and Associativity of Operators
• Comments
• Type Casting ( Implicit and Explicit)
Copyright
Copyright@@IT
Superior
Series College Kharian Rashad Mahmood (IT-Specialist)
www.itseries.com.pk
Q19 What is meant by data type of an expression?
The data type of each variable must be specified in its declaration, but how does C determine the data type of
an expression?
What is the type of expression x+y when both x and y are of type int?
The data type of an expression depends on the type(s) of its operands
The result of expression is evaluated to larger data type in the expression
If both are of type int, then the expression is of type int.
If either one or both is of type double,
then the expression is of type double.
An expression in which operands are of different data types is called mixed-type expression.
An expressions that has operands of both int and double is a mixed-type expression
variable = expression;
Examples
A = 100; A constant, variable or combination of
C = A + B; operands and arithmetical operators
X = C – D + 10;
Variable Declaration
Variable Declaration
Example:
A == B False
A != B True