Reading a book about C#. (newbie question)

Status
Not open for further replies.

Chad711

Daemon Poster
Messages
1,444
Location
Irving, TX
Let's just say I know nothing about programming. I have read some other books but lets just assuming I don't know anything when answering my questions here! :)

So I have this book called "Beginning C#" and I am using VS 2008. Some I am reading along and just barely into the book. Most the stuff so far is pretty straight forward. Not much about code yet. Mostly just introducing the UI of VS.

So I am at this part where it's introducing Variables. The first part if Simple Types. Every thing at this point is easy understanding then he says this:

"A variable storing "N" bits will allow us to represent any numbers between 0 and (2n - 1). Any numbers above this value will be too big to fit into this variable.

Note - the "n" that is in the parenthesis is suppose to be to the power of 2 but I don't know how to show that in the forum.

Ok so what is he talking about here? I'm totally lost. Is this some sort of math equation I'm suppose to understand or he just trying to tell me that N is a variable that could be any thing I make it? I got so lost here. He was explaining simple stuff then he throws this in there and made me look like a lost puppy!

Check back here when ever you see me post if you want to help me out! I will use this from now on. :)
 
Really what he is saying is a simple binary concept. Where n is the size of the variable in bits the number of values that variable can hold can be calculated by the sum 2^n. For example, if your variable is 8 bits it can have a value between 0 and 255 (or 256 values).
 
Ok I still don't understand completely but at least I know where he is going with it. I think my lack of not doing any math for many years might be part of the reason...

I'm just going to go with it and keep reading. This book is so big. Tiny print and 1030 pages!!! If I ever finish this, it will be the biggest book I ever read. hahaha
 
Status
Not open for further replies.
Back
Top Bottom