ECE 15 Lecture Notes - Lecture 3: Type Conversion, Increment And Decrement Operators

81 views3 pages

Document Summary

# note: / of integers yields an integer. Integer division (/: a, b integers, a/b is also an integer, round toward 0 (truncation) of actual ratio, division by 0----error! Modulo (%: a, b---integers, a module (mod) b, written a%b, is the remainder when a is divided by b, always: (a/b)*b +a%b=a, mod 0----error! Every expression has a value and a type. Value: determined by the operations, performed sequentially, need to define operation order. Type type: arithmetic problems on same-type operands result in same, arithmetic operations on different types convert, or promote, operands to the higher type according to: For example: 2/4. 0 2. 0/4. 0 0. 5: only exception to above rules is that result is always at least int. Assignment expressions: expression x; x+1; 2*pi*r, assignment expression: variable = expression x = y; x. = x + 1 left: evaluates expression on right, stores result in variable on, allows chain assignments: x = (y=3, for that reason(!

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents