본문 바로가기

Programming

C/C++ 의 asterisk (*)

The asterisk (*) is used in declaring a pointer for the simple purpose of indicating that it is a pointer (The asterisk is part of its type compound specifier). Don't confuse this with the dereference operator, which is used to obtain the value located at the specified address. They are simply two different things represented with the same sign


별표 (*)는 포인터를 선언하는 데 사용됩니다 (별표는 해당 유형 복합 지시자의 일부 임).

이것을 지정된 주소에있는 값을 얻는 데 사용되는 역 참조 연산자와 혼동하지 마십시오.

그들은 같은 부호로 표현 된 단순히 두 가지 다른 것들입니다.


헷갈리게 왜 똑같은 기호를 썼을까...


int x = 5;
int *p = &x;

x = x + 4;
x = *p + 4;

*p = *p + 4;


위 세줄 모두 같은 말임


출처는 solo learn ~

'Programming' 카테고리의 다른 글

논리 연산자 (Logical Operators)  (0) 2016.12.19