English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have this code:
Dim c
Dim w
c = 115
w = (c And 15)

When I run the code, the result w=3... But why ???
What is this code doing?? what does this comparison means ??

Help please

2007-07-11 09:10:20 · 1 answers · asked by André C 2 in Computers & Internet Programming & Design

1 answers

It is all to do with binary.
The binary value of 115 is 1110011
The binary value of 15 is 0001111
The and condition only allows bits through where both bits are on. So the result is 0000011 binary which is 3 decimal.

2007-07-11 09:19:34 · answer #1 · answered by AnalProgrammer 7 · 2 0

fedest.com, questions and answers