The arithmetic operators you're familiar with from Java were (pretty
much) inherited from C: +, -, *, /, %
. In C the modulus
If you mix ``narrower'' and ``wider'' types in an arithmetic expression, the result is wider:
int i; double d; ... i + d <--- double expressionAn assignment from a wider to a narrow type is legal. It may generate a warning:
int i= 3; double d= 3.14159; ... i= d <----- truncation may generate warningUse a cast statement to document (and reassure the compiler) that you know what you're doing:
int i= 3; double d= 3.14159; i= (int) d;