Dereferencing a pointer

Dereferencing a pointer means retrieving the actual data of the  pointer. Dereferencing a pointer can be done by writing pointer followed by *.

Example:

float x=25.15;
float *p;
p=&x;

Here p points address of x. Now we can retrieve the value of x as follows:
*p;

Code example:

#include<stdio.h>
int main()
{
    float x=25.15;
    float *p;
    p=&x;
    printf("value of x = %f",*p);
    return 0;
}

output

value of x = 25.150000


Next Previous