|
int *ppointer=&thevalue;
는
int *ppointer ;
ppointer = &thevalue;
와 같습니다.
단지, 선언과 동시에 초기화를 할때..C++에서 저런 코드를 사용합니다.
아래코드는 이미 선언이 되어 있으므로,
ppointer = &thevalue만 사용한것입니다.
김경래 님이 쓰신 글 :
: 안녕하세요
: 밑의 코딩을 보시면
: int *ppointer=&thevalue;
: ppointer = &thevalue;
: 식은 서로 다른데 왜 결과값은 똑같은지 궁금합니다.
: 즐거운 하루되세요
:
:
: #include <iostream.h>
:
: int main()
: {
: int thevalue=5;
: int *ppointer=&thevalue;
: cout << &thevalue<< endl;
: cout << *ppointer<< endl;
: cout << ppointer<< endl;
: ppointer = &thevalue;
: cout << &thevalue << endl;
: cout << *ppointer << endl;
: cout << ppointer << endl;
: return 0;
: }
:
:
|