Pointer in C

In this tutorial, we will learn about Pointer in C. C Pointer are variables which store the address of another variable. We can create a Pointer variable of any type such as int, char, array, function, or any other pointer. Before going further it is important to know that how we can declare a pointer variable in C.

Declareing a Pointer in C:

To declare a Pointer variable in C. We have used a * (asterisk symbol). Please check out the following example program.

#include <stdio.h>

int main()
{
    int num = 20;   
    int* p = &num; 
}

In the above example, you can clearly see we have created a normal variable class num and initialised this variable with the value 20. After that, we have created a pointer variable called p with the help of *(asterisk symbol) and stored the address of num variable(operator ‘&’ returns the address of a variable) into this pointer variable.

Spread the love
Scroll to Top
×