View Single Post
Old Apr 28th, 2008, 1:05 PM   #11
opa6x57
Hmmmm ... Is there more??
 
opa6x57's Avatar
 
Join Date: Apr 2008
Location: Post Falls, ID
Posts: 15
Rep Power: 0 opa6x57 is on a distinguished road
Re: Bitwise Operators...

Quote:
Originally Posted by redfiretruck View Post
Yes. Open your windows calculator - and switch to 'scientific view'. Then, there are 4 radio buttons in the upper left portion of the calculator's keyboard. You can quickly see how some of these numbers work if you type in a number (say 8), then click the 'bin' radio button - the calculator will convert the 8 into it's binary equivalent - 1000.

This calculator also has some of the logical operators you're trying to understand ... there's an 'AND' and an 'OR' you can play with these in either BINARY mode or in DECIMAL mode. In fact, you can switch between the modes - as you go through some of the steps.

In Decimal, for example ...
255 {AND} 5 = 5 
250 {AND} 5 = 0

The binary equivalent of this would be:
255 = 1111 1111
5   = 0000 0101
1111 1111 {AND} 0000 0101 = 0000 0101
1111 1010 {AND} 0000 0101 = 0000 0000


Quote:
Originally Posted by redfiretruck View Post
  • I have read that chars are representated by integers correct? Such as Char 'A' is 65? Well, how does the computer recognize the difference between 65 and A? Just wondering ^_^.
This is really determined by the datatype of the variable used. (I'm most familar with the BASIC forms of this ... so, I should probably let some of the C programmers answer your question about this in C.)

In most forms of BASIC - you would tell by how you dimension the variable.
If I wanted to use the ASCII codes (the '65' in your example) then I'd have to dimension the variable as a byte or integer. If, I wanted to use the variable to hold the letter "A", then I'd have to dimension the variable as a string of some kind.


Quote:
Originally Posted by redfiretruck View Post
  • Also... When i read through stuff like source codes and the example listed above that is in code... Even with comments, they are confusing and take a few minutes to understand? Is that normal for someone starting out?
Yes.
Think about your favorite book. Now, imagine someone gave you a copy of that book which had been translated into Russian. You'd have a very difficult time reading your favorite book - since it's written in a language you don't understand.

Learning a new programming language is probably not as bad as Russian - but, it could be...

(I apologize for posting my example code in VB syntax - I used what I'm most familar with... eeeek.)
__________________
Ken -
New to PFO ... but been dabbling in various versions of BASIC since highschool - circa 1973.

"Shouldn't the 'Air and Space' museum be empty?" - Dennis Miller
opa6x57 is offline   Reply With Quote