As far as I know ref++ points to the next element of the array (here 200) but how does it know it has to be 201? Does it go back to the defintion long* ref = n at line 5 to check that it has to be equal to n?
secondly, why did n[1] on the third cout become 202 when n is only incremented once at n[1]++ at line 6?
Lastchance has the right answer. The pointer *ref is pointing to the value in your array n[1], not the address. So by adding +1 to the pointer which is pointing to the value, your incrementing by 1.
@muffin123,
n[1] was increased from 201 to 202 on line 14, because ref was pointing to it at the time; *ref is effectively n[1] at that line, so what you do to *ref you are doing to n[1] there.