I got it working. I was a single level pointer. I had to use ptest[i*m+j*n+k] to make it work.