cp_1_lect_22 - 5/10/10 Precedence & Associativity of...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
5/10/10 High priority * / % However, the order of evaluation can be changed by introducing parentheses
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Operators Associativity Rank (),[ ] L to R 1 R to L 2 *, /, % L to R 3 Binary plus(+) and Binary minus (-) L to R 4 <<, >> (bitwise SHIFT, later chapters) L to R 5 <, <=, >, >= L to R 6 ==, != L to R 7 L to R 8 ^ (bitwise XOR, later chapters) L to R 9 | (bitwise OR, later chapters) L to R 10 L to R 11 || L to R 12 ?: R to L 13 R to L 14 , L to R 15
Background image of page 2
5/10/10 Assume a = 1, b = 2, c = 3, and d = 4. x = a * b + c * d / 2; same as: x = (a * b) + ((c * d) / 2); For long or confusing expressions, use parentheses, because reader might no
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
5/10/10 reading input through the keyboard #include <stdio.h> void main () { /* We will use a floating-point and an integer variable. */ double x; int n; /* Read in an integer. */ printf("Please enter an integer: ");
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/07/2010 for the course CS&IS TA C162 taught by Professor Kavitha during the Spring '09 term at Birla Institute of Technology & Science.

Page1 / 14

cp_1_lect_22 - 5/10/10 Precedence &amp; Associativity of...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online