기초

포인터 복습(&,*)

알쿠미 2015. 12. 18. 03:50
1
2
3
4
5
6
7
8
9
10
    int *nptr;
    int a = 5;
 
    nptr = &a;
 
    cout<<"&a : "<<&a<<endl;
 
    cout<<"nptr : "<<nptr<<endl;
    cout<<"&nptr : "<<&nptr<<endl;
    cout<<"*nptr : "<<*nptr<<endl;
cs

결과



&는 주소값

*는 가리키는값


포인터 변수에 주소값을 넣기 위해서 마련된 것이 &연산자이다.