title: In C, are the arithmetic operators the same for integers and floating points?
body: <p>I'm quite new to C, and recently I have discovered some (to me) "weird" behavior in some of its arithmetic operators.</p>
  
  <p>Since 'f' is a float, I expect the result of '3 / 2' to be 1.5 (as in the second example), but somehow it is the result of an integer division.</p>
  
  <p>In the second example, since 3.0 and 2.0 are both floats, the result now is (as expected) 1.5.</p>
  
  <p>And finally, in the third example, 3.0 is a float, 2 is an integer. The result of '3.0 / 2' is 1.5, thus the result of a float division.</p>
  
  <p>I therefore conclude that there are two different types of division: A integer division of form [int] / [int] = [int] and a float division [float] / [float] = [float]. In the third example, before dividing, '2' is simply casted to a float.
  In the first example the integer division '3 / 2' is performed, and afterwards casted to a float (thus the value 1.0). </p>
  
  <p>Is this the actual way how C "interprets" arithmetic operations? Am I right with my assumptions?</p>
  
  <pre><code>f = 3 / 2;          // f = (float) (3 / 2)
  printf("%f\n", f);  // 1.000000
  
  f = 3.0 / 2.0;      //
  printf("%f\n", f);  // 1.500000
  
  f = 3.0 / 2;        // f = 3.0 / (float) 2
  printf("%f\n", f);  // 1.500000
  </code></pre>