Access Variable through its Pointer || Pointers || C Programming
In this, we are going to access a variable through its pointer by using Pointers in C Programming Language.

 

#include <stdio.h>
int main()
{
    //declare variables
    int x, y;
    int *ptr;
    //intialization
    x = 100;
    ptr = &x;
    y = *ptr;
    printf("value of x is %d\n", x);
    printf("%d is the address of %u\n", *ptr, ptr);
    printf("%d is the address of %u\n", ptr, &ptr);
    printf("%d is the address of %u\n", y, &y);
    return 0;
}

//..........Coded by Ananya Maurya

#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post