& symbol in C represents two distinct operators depending on its lexical context and arity: the unary address-of operator, which yields the memory address of its operand, and the binary bitwise AND operator, which performs a bit-by-bit logical conjunction on two integer operands.
Unary & (Address-of Operator)
When used as a prefix unary operator, & evaluates to the memory address of its operand, effectively generating a pointer value that points to that object within the C abstract machine.
- Operand Constraints: The operand must be a valid lvalue (an expression that designates an object with an identifiable memory location), a function designator, or an array name.
- Restrictions: The unary
&cannot be applied to expressions that are not lvalues (such as literal constants or temporary expression results), bit-fields within astruct, or variables explicitly declared with theregisterstorage class specifier. - Type Evaluation: If the operand is of type
T, the resulting expression&operandevaluates to a value (which is not an lvalue) of typeT*(pointer toT).
Binary & (Bitwise AND Operator)
When used as an infix binary operator, & performs a bitwise logical AND operation. It compares the binary representations of two operands bit-by-bit, yielding a new value based on strict logical conjunction.
- Operand Constraints: Both operands must be of integral types (e.g.,
char,short,int,long, or theirunsignedvariants). The operator cannot be applied to floating-point types, pointers, or aggregate types. - Type Promotion: Prior to the operation, the compiler applies the usual arithmetic conversions to both operands to establish a common type. The result of the expression evaluates to this common promoted integral type.
- Evaluation Logic: For each corresponding bit position in the promoted operands, the resulting bit is set to
1if and only if both operand bits are1. Otherwise, the resulting bit is0.
Tired of Poor C Skills? Fix That With Deep Grasping!Learn More





