This preview shows pages 1–3. Sign up to view the full content.
Introduction to LowLevel
Programming Concepts
CMSC 212
ecture 7
1
CMSC 212
Lecture 7
September 22, 2009
Last time
●
Chapter 10, Structures and unions
– pointers to structures
– passing pointers to structures as parameters
– unions
●
Chapter 5, Operators and expressions
ssignment and the compound assignment operators
2
CMSC 212
– assignment and the compound assignment operators
– unary operators
– the relational, equality, and logical operators
Reading
●
Read Chapter 6 in Reek (Pointers on C)
3
CMSC 212
Chapter 5, Operators and
Expressions, con't.
4
CMSC 212
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document Other operators
●
The ternary conditional operator has the form
expr
1
?
expr
2
:
expr
3
– if
expr
1
is nonzero,
expr
2
is evaluated and is the result
– if
expr
1
is zero,
expr
3
is evaluated and is the result
– what is
a= (2 > 3) ? 65 : 17;
– only one of the second two expressions is ever evaluated
he comma operator evaluates both of its operands, by
5
CMSC 212
●
The comma operator evaluates both of its operands, by
definition first the left operand and then the right one,
and the value of the right operand is the operator's result
printf("useless but valid: %d\n", (1, 2, 3));
b= 1; c= 2;
a= (b++, c += 2);
b= 1; c= 2;
a= b++, c += 2;
b= 1; c= 2;
if (c += 3, b)
printf("hmmm…");
Bit operations
●
Numbers are represented in a computer using a fixed
number of bits
– commonly a
This is the end of the preview. Sign up
to
access the rest of the document.
This note was uploaded on 11/23/2009 for the course CMSC 212 taught by Professor Staff during the Spring '08 term at Maryland.
 Spring '08
 staff

Click to edit the document details