Therefore, we cannot change
a pointer constant.
If you want to increment the address, it is necessary to store the base address into
a pointer variable first and then increment this pointer.
Note: There is a difference between *ptr++ and *(ptr++); this difference lies in the
precedence of the operators. The ++ operator has a lower precedence than the * pointer
operator. So, in the first expression, the value at the address ptr is retrieved first and
increments its value. In the second expression, the pointer is incremented first and then the
value is retrieved from this new address. The parentheses override the default precedence. The
Do'stlaringiz bilan baham: |