LEC:14,

POINTERS | POINTER to POINTER




POINTER TO POINTER





Source code:

/*

    POINTER:

    A pointer however, is a variable that stores the memory address as its value.

*/

#include<iostream>

using namespace std;

int main()

{

 /*

    int a=56;

    int* b=&a;

    cout<<"the address of a : "<<b<<endl;

    cout<<"The value of a : "<<a;

    cout<<"the address of a : "<<&a<<endl;

    */


    int m=77;// data item

    int* n=&m;// pointer that store the adress of m

    int** p=&n;// pointer that store the adress of another pointer n

    cout<<"The value of m :"<<m<<endl;// 77

    cout<<"The Address of m :"<<&m<<endl;//address

    cout<<"The Address  of m :"<<n<<endl;//address

    cout<<"The Address of n : "<<p<<endl;

    cout<<"The value of n : "<<*p<<endl;

    cout<<"The value of m using **p : "<<**p;

    return 0;

}



Comments

Popular posts from this blog

RunwayWithCode

web development Lectures

C++ Lectures