Program to delete duplicates from a link list

How to access the value of some variable using pointer

How to access the value of some variable using pointer :-

In this article we will learn how to access the value of  any variable by using pointer . lets there is a variable and a pointer PFor access the value of  x by using pointer P we have to Asterisk ( * ) operator. 

#include<stdio.h>
int main()
{
    int x=10;
    // pointer declaration
    int *p;
   // pointer initialization
    p=&x;
    printf("Value of X is %dn",x);
    printf("Address of the x is %un",&x);
    printf("Address of X or Value of pointer P is %un",p);
    printf("Value of X using pointer P %dn",*p);
    printf("Address of P is %un",&p);
    return 0;
}

 

Output:-

Value of X is 10
Address of the x is 3315116764
Address of X or Value of pointer P is 3315116764
Value of X using pointer P 10
Address of P is 3315116768

 

 

Recommended Post:

Key points:-

Cracking the coding interview:-

Array and string:-

Tree and graph:-

Hackerearth Problems:-

Hackerrank Problems:-

Data structure:-

 MCQs:-

 

 

Leave a Reply

Your email address will not be published.