title: How is an integer stored in memory?
body: <p>This is most probably the dumbest question anyone would ask, but regardless I hope I will find a clear answer for this.</p>
  
  <p>My question is - How is an integer stored in computer memory?</p>
  
  <p>In c# an integer is of size 32 bit. MSDN says we can store numbers from -2,147,483,648 to 2,147,483,647 inside an integer variable.</p>
  
  <p>As per my understanding a bit can store only 2 values i.e 0 &amp; 1. If I can store only 0 or 1 in a bit, how will I be able to store numbers 2 to 9 inside a bit?</p>
  
  <p>More precisely, say I have this code <code>int x = 5</code>; How will this be represented in memory or in other words how is 5 converted into 0's and 1's, and what is the convention behind it?</p>