1
2
3
4
5
const int num = 10;                // 변수 num을 상수화
const int *ptr = &val;            // 포인터 ptr을 이용해서 val1의 값을 변경할 수 없음
int *const ptr2 = &val2;        // 포인터 ptr2가 상수화 됨
const int *const ptr3 = &val3;    // 포인터 ptr3가 상수화 되었으며, ptr3를 이용해서 val3의 값을 변경할 수 없음
 
cs

+ Recent posts