tags:

views:

70

answers:

2

we know meaning of pointers for example to get location of variable

int t=9;

we use following notation

int *p=&t;

how can i obtain address of variable in memory by bitwise operatos and bits manipulation? can i do it in general or what is equivalent of pointer in bit world?i am using c++

+2  A: 

You can't get the adress via bitwise operators. You have to use the "address of" operator.

Tapdingo
+2  A: 

Using bit wise operators like and and or, you can't get the address of an arbitrary variable, no.

At some point, you have to use &.

If you're talking about manipulating bits within one of the more basic types, there are (at least) two approaches you can take:

  • Specify bit-field structures such as struct { int bit:3 } where the number after the : is the number of bits; or
  • Use bitmasking tchniques like threebits = sixteenbits & 0x07;.
paxdiablo