codegurukool.com · Free coding tutorials & online compiler

Home › C Tutorial › C memory address

C memory address

Where a variable lives.

&x gives the address of x. Print it with %p. The value differs every run.

Example code

#include <stdio.h>
int main() {
  int x = 5;
  printf("%d at %p\n", x, (void*) &x);
  return 0;
}

Run this code in the online editor

← C user inputC pointers →