Mega Code Archive

 
Categories / C++ Tutorial / Data Types
 

Creating and Using References

#include <iostream>    int main()  {      int  intValue;      int &intReference = intValue;        intValue = 5;      std::cout << "intValue: " << intValue << std::endl;      std::cout << "intReference: " << intReference << std::endl;        intReference = 7;      std::cout << "intValue: " << intValue << std::endl;      std::cout << "intReference: " << intReference << std::endl;      return 0;  } intValue: 5 intReference: 5 intValue: 7 intReference: 7