'why doesn't the result of an array member changed when have assigned it? [closed]

when I did something like this:

int arr[]={11, 12, 13, 14, 15};
int *p=arr;
*(p++) += 100;

The result of arr[1] was still 12,why?



Solution 1:[1]

You are adding 100 to the first element of the array arr[0] and then moving p to the next element arr[1]. This expression:

*(p++) += 100;

Is actually translated into this:

*p += 100;
++p;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pax