The problem is your use of pointer math, which in this case is not needed.
In C/C++ when adding a value to a pointer, the compiler does not add the integer value to the base pointer, but computes the size of the reference item and adds that to the base pointer.
Lets say we have this:
int a[10];
int *p = a;
If we print the value of p (i.e. the memory location that p points to) we might get a value like 0x800. Then if we print the value of (p+1), we do not get 0x801, but in fact get 0x804. The compiler does the calculation of item sizes for you.
So, if we wanted to use p to assign the values 10..19 to array a, above, we can write
for(int i = 0; i < 10; ++i)
p[i] = i + 10;