CEng140 - Week3[1] - CEng-140 Week 3 Today Constants &...

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

View Full Document Right Arrow Icon
CEng-140 Week 3
Background image of page 1

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

View Full DocumentRight Arrow Icon
Today Simple input/output Conditionals
Background image of page 2
Integer constants short int unsigned int long int unsigned long int
Background image of page 3

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

View Full DocumentRight Arrow Icon
String Constants “deneme bir iki” “deneme bir iki” \ “uc dort bes” “deneme \ ” bir iki”
Background image of page 4
Character Constants ‘a’, ‘1’, ‘%’, … \ ’’ ‘c’ vs “c”
Background image of page 5

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

View Full DocumentRight Arrow Icon
Floating Points float double long double
Background image of page 6
Type Conversion char, short int long float double long double Automatic Type Conversion Rules * Advice: Avoid automatic type conversion!
Background image of page 7

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

View Full DocumentRight Arrow Icon
Arithmetic Operators & Precedence Operator Type Associativity + - Unary Right to left * / % Binary Left to right + - Binary Left to right C uses infix notation: a + b * c prefix notation: + a * b c postfix notation: a b c * +
Background image of page 8
Increment, Decrement Operators ++a, --a vs a++, a--
Background image of page 9

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

View Full DocumentRight Arrow Icon
Compound Assignment Operators var op= expr += -= *= /= %=
Background image of page 10
Some examples i += j = k; i = j += k;
Background image of page 11

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

View Full DocumentRight Arrow Icon
Output printf (format string, var1, var2, … ) Format string contains: d,i: integers f: float, double e: float, double in exponential notation c: character s: string
Background image of page 12
Input scanf (format string, var1, var2, … ) var1, var2, . .: addresses of memory locations! Format string contains: d,i: integers f: float, double e: float, double in exponential notation c: character s: string
Background image of page 13

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

View Full DocumentRight Arrow Icon
Simple Macros For long and/or frequent constants: # define PI 3.14159265 For long and/or frequent calculations: # define Area(Radius) (4*PI*Radius*Radius) … a = 10.0 + Area(2.0);
Background image of page 14
Side Effects Due to expressions that change variables: Example: i = (i++) ? (i+1) : (i-1); v + v++ + v + v++
Background image of page 15

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

View Full DocumentRight Arrow Icon
Image of page 16
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/06/2011 for the course CENG ceng 230 taught by Professor Prof.osmanwxw during the Spring '10 term at Middle East Technical University.

Page1 / 40

CEng140 - Week3[1] - CEng-140 Week 3 Today Constants &...

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

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