Friday, 11 July 2014

How to Find Memory Address of a Variable

Structure of the Problem Requirements 

Pointers are used to find the Memory address of the variables in C++. Pointers are also variables which hold the memory address instead of values. In Programming and complex Data Structures Pointers are used to Pass Value by Reference. In this problem we just get two integers and show their Memory Address. Hope you will get a clear concept about Pointers in this Tutorial.

Source Code

#include <iostream>

using namespace std;

In this programme the value of pointer is Increment with each value.
int main ()
cout<<endl<<endl<<"*********** POINTER IN C++ *************"<<endl;
    const int max = 3;   //iintilize a costant variable with max is 3
    int  value[max]; //Declarte a array of value with 0,1,2
    int  *pointer; //Declare a variable taht's initeger type pointer
    for(int i=0;i<max;i++)
           cout<<"Enter Value: \t";
   pointer = value; //all the values are assign to pointer mean memory address
   for (int j = 0; j < max; j++)
      cout << endl <<  "Value Address"<< j <<" = ";
      cout << pointer << endl;

      cout << endl <<  "Value Address"<< j <<" = ";
      cout << *pointer << endl;


    return 0;

Output of the Program

Pointer are the Memory address
Pointer Programmed Output

Share it Please

About Author!

Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.

2 comments: Post Yours! Read Comment Policy!▼
Important Note:
We have Zero Tolerance to Spam. Chessy Comments and Comments with Links will be deleted immediately upon our review.

  1. How to find Memory :p basically it's not a physical :p

  2. Accroing to Prgramme we Find Memory :p