4. Pointer Arithmetic
Suppose int *pa = a;
Pointer not an int, but can add or subtract an int from a pointer: pa + i points to a[i]
*(pa+i)      // the contents of a[i]
Address value increments by i times size of data type Suppose a[0] has address 100. Then a[3] has    address 112.
Suppose char *pc= (char *)pa.
– What value of i satisfies (int *)(pc+i) == pa + 3?
– Answer: i = 12
이전페이지 / 5 / 다음페이지