W7Code » C Language » Pointers in C Programming Language

In c the variables take up space a in memory, namely in RAM memory. We can say that ram memory is a huge vector of bytes where all variables are stored. Each variable is stored in a specific memory address. Where the positions inidices vary between 0 and the total bytes of the Ram memory. Pointers in c allow us manipulate directly space in memory. When we declare a variable in c, we are saying to the compiler to save a certain space in memory to store the content of that variable.

Declare Pointers in C


Syntax Explained

  • variable_type, we already have learn;
    • float, int, char, double.
  • *  indicates that it is a pointer-type variable;
  • variable_name, is the name of the pointer that follow the variable name declarations.


This is an example of how to declare a pointer in c:



We have being using pointers since the beginning. When we call the function scanf and use & to store the content of the variable. We are saying to the compiler to save the variable content in the address of that variable.



When we use this we are passing by reference the address of variable pointer.


How to Assign an Address to a Pointer?

Use pointers in c is a very delicate process. In c it is possible to assign an address to a pointer bellow:

  • We declare a variable number of type integer, and a pointer named pointer of type int;
  • Then we are assigning the address to pointer  variable using &.
    • get the address of variable number using, &number.


If we do not want our pointer to return no value we assign it the NULL constant.


Pointer of a Pointer

And if we want know the address of a pointer?

  • This is a tricky, but simple process.  Works the same way when we declare a pointer:

Do you have any doubt about pointer? Please comment bellow!

Leave a Reply