Pages

C++ Programming Tutorials - 9 (Pointers)

tut12.cpp =

// This tut contains pointers in c++
#include<iostream>;
using namespace std;

int main(){
    int a=5;
    intb=&a;
    // & is a (address of) operator

    cout<<"The address of a is : "<<&a<<endl;
    cout<<"The address of a is : "<<b<<endl;

    // * is a (value at) deference operator

    cout<<"The value assigned to address b is : "<<*b<<endl;
    
    // Pointer to pointer

    int** c= &b;
    cout<<"The address of b is : "<<&b<<endl;
    cout<<"The address of b is : "<<c<<endl;
    cout<<"The value at address c is : "<<*c<<endl;
    cout<<"The value of object assigned at address c is : "<<**c<<endl;

    return 0;
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Top 10 Python Packages Every Developer Should Learn

Top 10 Python Packages Every Developer Should Learn There are more than  200,000 Python packages  in the world (and that’s just counting tho...