Pointer Arithmetic - Identical Expressions?

Are the results of these expressions the same?

&(*ptr) += 4 // Expression 1
ptr += 4 // Expression 2

I am mainly a Java developer who was tasked with recompiling an old project from VS2008 to VS2015. The first line above leads to a compilation error due to the fact that the left operand is not a mutable value of l. The question is, can I use the second expression instead of the first, since from what I understand they should be the same?

ptr is of type char*.

It would be very grateful for your understanding and / or help on this issue.

+4
source share
1 answer

& lvalue, , (&a)++ , &a. , . (, , , l). , &(*ptr) = ptr, , &(*ptr) - , . 4 .

, .

EDIT: , VS2008. & ( , ). , . , , . , ptr. (, + =, , ).

+1

Source: https://habr.com/ru/post/1687854/


All Articles