참조자(Reference)
참조자(Reference)
참조자의 선언
#include <iostream>
using namespace std;
int main(void)
{
int num = 10;
int &ref = num; // 참조
int &dref = ref; // 참조
cout << &num << endl; // 주소출력
cout << &ref << endl;
cout << &dref << endl;
return 0;
}참조자와 함수
Call-by-value
Call-by-reference
참조자를 이용한 Call-by-reference
참조자와 const
반환형이 참조자료형인 함수
잘못된 참조 반환
상수화된 변수를 참조하는 const 참조자
Last updated