Basic integer explanation in C++
<p>This is a very basic question.Please don't mind but I need to ask this. Adding two integers</p>

<pre><code>int main()
{
     cout&lt;&lt;"Enter a string: ";
     int a,b,c;
     cout&lt;&lt;"Enter a";
     cin&gt;&gt;a;
     cout&lt;&lt;"\nEnter b";
     cin&gt;&gt;b;
     cout&lt;&lt;a&lt;&lt;"\n"&lt;&lt;b&lt;&lt;"\n";
     c= a + b;
     cout &lt;&lt;"\n"&lt;&lt;c ;
     return 0;
}
</code></pre>

<p>If I give a = 2147483648 then
b automatically takes a value of 4046724. Note that cin will not be prompted
and the result c is 7433860</p>

<p>If int is 2^32 and if the first bit is MSB then it becomes 2^31</p>

<p>c= 2^31+2^31</p>

<p>c=2^(31+31)</p>

<p>is this correct?</p>

<p>So how to implement c= a+b for a= 2147483648 and b= 2147483648 and should c be an integer or a double integer?</p>
