9.6 Introduction to pointers

주홍영·2022년 3월 13일
0

Learncpp.com

목록 보기
97/199

https://www.learncpp.com/cpp-tutorial/introduction-to-pointers/

infamous한 pointer이다

일단 몇몇 사항들만 간단하게 집고 넘어간다

pointer를 다루면 ampersand와 asterisk과 같은 특수 문자를 자주 볼 수 있다
하지만 이 둘은 어떻게 사용되느냐에 따라서 용도가 확연히 다르다
만약 type definition에서 사용된다면 각각 &(lval ref), *(pointer)
타입을 의미하는 것으로 쓰이고

만약 operator로 사용된다면 ampersand는 address, asterisk는 dereference operator
로 사용된다 dereference는 역참조라는 말이다

참고로 lval refer와 다르게 pointer는 initialiazation이 필수가 아니다

pointer의 크기는 32bit 환경에서는 4byte이고 64bit 환경에서는 8byte이다
즉 메모모리를 pointer가 담게되는 정보이므로 메모리 사이즈 환경에 따라 다르다

profile
청룡동거주민

0개의 댓글