Header Ad

C++ program to access value of variable using pointer

In this post, we will write a C++ program to access the value of variables using a pointer.

C++ program to access value of variable using pointer


C++ program to access value of variable using pointer.

#include<iostream>
#include<conio.h>

int main()
{
    system("cls");

    int a;
    int *p;

    a=5;
    p = &a;

    std::cout<<"The value of a = "<<*p<<std::endl;

    getch();
    return 0;
}



Output

The value of a = 5

Post a Comment

0 Comments