0
c malloc
Why do you have to add +2 to the pointer. *(ptr + 2) = 50; /* assign 50 to third int */
2 odpowiedzi
+ 3
According to the comment, 50 is assigned to the third int. The third int has the offset 2. ptr points to the first int, ptr + 1 to the second and ptr + 2 to the third one.
+ 1
*(ptr + n) is equivalent to ptr[n] or n[ptr]