addressof() in C++

addressof(): This function is available in the library move.h.

It returns the actual address of the object or function referenced by r, even in 

the presence of an overloaded operator&. 

Parameters: 

__r – Reference to an object or function. 

Syntax:

addressof(__r)

For Example:

arr = {1,2,4,5}

addressof(arr)  => It returns address of arr (i.e 0x61fdd0).The value of address 

will we different for different users

Approach

C++

#include <bits/stdc++.h>
using namespace std;

int main()
{
    vector<intarr = {1245};

    cout << addressof(arr<< "\n";

    return 0;
}


No comments:

Post a Comment