[C++] Pointer vs Reference
Pointer vs Reference 보통 C 언어에서 변수를 가리킬땐 포인터를 사용 했다. C++ 에선 포인터 와 함께 레퍼런스(참조자) 라는 개념이 도입됬는데 그 둘의 특징과 차이점을 알아보자. Pointer 사용자가 접근하고 싶은 메모리의 주소를 담는 하나의 변수(Varilable) 이다. 그러므로 자기 자신의 주소를 가지고 있다. 어떤 자료형이든 고정된 크기를 가진다 32bit 시스템 - 4byte, 64bit 시스템 - 8byte de-reference operator를 이용하여 직접 적으로 가리키고 있는 메모리에 들어가 값을 다룰 수 있다. (* , 클래스나 구조체 에선 ->) Reference 사용자가 선언해둔 변수에 새로운 별명(aliance) 이다. 따로 de-refrence operat..
2021.02.11