Pointer types

C allows a programmer direct access to memory locations via memory addresses. A pointer type declares that a variable of its type contains an address pointing to some address in memory where a certain variable is stored. The size of a pointer type is implementation dependent but usually just int. (Yes, the size of a pointer itself can be larger than what it points to).

  int i = 5;
  
  int* iPointer;  // a variable of "pointer to int" type is declared

  iPointer = &i;  // the pointer variable contains now the address of i
  
  *iPointer = 10; // the content of i now changed to 10

  printf("content of i %d :" i); // gives 10

The ampersand operator & represents the address of a variable. And a pointer is never just a pointer alone. It is always a "pointer to" some type. The asterisk operator takes the content of the pointer - a memory address and goes to this address to retrieve what is stored there. Pointers are very powerful as we will see but lets say the *pointer = 10; statement would be in a different file. Then suddenly i would change and nobody would know why.