title: C++ casting int to double
body: <p>I'm not a C++ developer, but today I've found a C++ code and try to understand it. So I've stacked on this piece of code:</p>
  
  <pre><code>int m = 2, n = 3, i = 1;
  double mid = (double)m / n * i;
  int d = (int)mid + 1;
  
  printf("%d %d\n", mid, d);
  </code></pre>
  
  <p>The result which is going to be printed to the console is: 1431655765 1071994197. It seems to be related with the casting of variable m to double, but I have no idea how it is happening. I need someone to help me understand it. Thanks in advance!</p>