& Unary Address operator; Bitwise Binary AND operator
&lvalue Address of lvalue (used as unary address operator)
or
exp1 & exp2 Bitwise AND operator (used as binary AND operator)
The & operator has two different meanings, depending upon its
context.
When used as a unary operator, & returns the address of a variable or
function. This value can then be assigned to any pointer; you may
need to use a type-cast if the pointer you're assigning the address
to has a different type than lvalue. Here are two examples using &
as a unary address operator:
myptr = &i;
myfncptr = &myfunc;
When used as a binary operator, & performs a bit-by-bit AND operation
on exp1 and exp2. For example:
i = 0x0FF0;
j = 0xFF00;
k = i & k; /* k == 0x0F00 */
Seealso:
This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster