Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C

Address-of operator (&)

The unary & operator produces a pointer to an object or function. It enables operations such as modifying an object indirectly through a pointer.

Version: C23; repository compiler flag, production runtime not attested

Syntax

&operand

Unary & obtains its operand's address: for type T, the result is T *, preserving qualifiers such as const. Do not confuse it with binary bitwise AND: a & b.

The operand can be a function designator, the result of [] or unary *, or an lvalue designating an object that is neither a bit-field nor declared register. The expression &42 is invalid.

In the example, &value points to value, and assignment through *pointer changes that object. Taking an address does not extend the object's lifetime.

Examples

#include <stdio.h>

int main(void)
{
    int value = 7;
    int *pointer = &value;
    *pointer = 12;
    printf("%d %d\n", value, *pointer);
    return 0;
}

Result

12 12

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources