What does int * means?

This declares a pointer to an integer. It means that the variable a can store the memory address of the integer variable.

You can use another variable of type integer pointer ‘a’ to point to a single integer variable:

int x = 10;

int *a = &x; // ‘a’ points to the integer variable ‘x’

a stores the address of an integer variable, so you can dereference it using the * operator to access the value of the integer it points to like *a.

Example

C




// C Program to illustrate 'int *'
#include <stdio.h>
  
int main()
{
    int x = 20;
    int* a = &x;
    // 'a' is a pointer to an integer
    // pointing to 'x'
    printf("The Value of x: %d\n", x);
    printf("The Value pointed to by 'a': %d\n", *a);
    return 0;
}


Output

The Value of x: 20
The Value pointed to by 'a': 20

In this example, int *a; declares a single-level pointer a which points to the integer variable x. a stores the memory address of the x and you can access the value of x using the *a.

Difference between int *a and int **a in C

In C, the declarations int *a and int **a represent two different concepts related to pointers. Pointers play a fundamental role in memory management and data manipulation in C programming so it is important to have a clear understanding of them.

Similar Reads

What does int * means?

This declares a pointer to an integer. It means that the variable a can store the memory address of the integer variable....

Understanding ‘int **’

...

Difference Between ‘int *’ and ‘int **’ in C

This declares a pointer to a pointer to an integer. It means that the variable a can store the memory address of the pointer to an integer variable....

Contact Us