Skip to main content

Meaning of & and * in C

Short answer

& is a unary address-of operator (e.g., &x gives address) and a binary bitwise AND. * indicates a pointer in declarations (int *p), is a unary dereference operator (accessing value at address), and a binary multiplication operator.

What are the significant meanings of '&' and '*' established in C programming?

Meaning of &

  1. Address-of operator (unary): &x gives the memory address of x. Example: p = &x; and scanf("%d", &x);.
  2. Bitwise AND (binary): a & b ANDs each bit, e.g. 5 & 3 = 1.
  3. (&& is the separate logical AND.)

Meaning of *

  1. Pointer declaration: in int *p; the star says p is a pointer.
  2. Indirection (dereference) operator (unary): *p gives the value stored at the address held by p.
  3. Multiplication (binary): a * b.
#include <stdio.h>

int main(void)
{
    int a = 5, b = 3, c;
    int *p = &a;            /* & : address of; * in declaration: pointer */
    c = *p * b;             /* * : value at address (dereference), then multiply */
    printf("%d %d %d\n", c, a & b, a * b);
    return 0;
}

Output: 15 1 15 (c = *p × b = 5 × 3 = 15, then a & b = 1, then a × b = 15).

✓ Answer checked by Claude Opus 5.5 (high effort)

All Computer Programming chapter 9 questions →