Using the Address of Operator on References - C++ Data Type

C++ examples for Data Type:Reference

Introduction

A reference address is the address of its target.

Demo Code

#include <iostream> 
 
int main() //from w w w. j  a v  a  2s. co  m
{ 
    int  intOne; 
    int &rSomeRef = intOne; 
 
    intOne = 5; 
    std::cout << "intOne: " << intOne << std::endl; 
    std::cout << "rSomeRef: " << rSomeRef << std::endl; 
 
    std::cout << "&intOne: "  << &intOne << std::endl; 
    std::cout << "&rSomeRef: " << &rSomeRef << std::endl; 
 
    return 0; 
}

Result


Related Tutorials