title: Can garbage value be expected in c++?
body: <p>My teacher told  me that he is studying about compiler and he found out that garbage value in c++ can be expected or calculated with a formula like this =</p>
  <p>Range of that datatype - size of datatype = garbage value of that datatype.</p>
  <p>For example : for integer it should be -</p>
  <p>2,147,483,647 (range of int) - 4 (size of int) = 2,147,483,643</p>
  <p>and the next memory for int will be - 4 bit every single time.</p>
  <p>I was expecting result to be 2,147,483,643</p>
  <p>When I test it myself I didn't work for me This is my code -</p>
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  int main(){
      int a,c,d;
      cout&lt;&lt;a&lt;&lt;&quot; &quot;&lt;&lt;c&lt;&lt; &quot; &quot; &lt;&lt;d;
  }
  </code></pre>
  <p>Output =
  4352496 7339908 4352384</p>
  <p>What I expected = 2,147,483,643 , 2,147,483,639 , 2,147,483,635</p>
  <p>Does this mean my teacher was incorrect? he studied wrong thing? Was he talking about another range and another size? I misunderstand something? Can anyone please clear me.</p>
  <p>I search this term on google but couldn't find any solutions.
  I found this surprising is it even possible to calculate the garbage value?</p>