Iterating pointers on the host allocated with cudaMalloc()

Would iterating a pointer which points to memory that has been allocated on the device using cudaMalloc() work on the host side the same as it would in a kernel?

e.g. if I execute on the host:

float * ptr;
cudaMalloc((void**)&ptr, 10 * sizeof(float));
float * ptr2 = ptr + 5;

Can I now pass ptr2 to a kernel to get the desired behavior starting on the 5th element of the array? Or is it necessary to do the + 5 in the kernel?

Yes, you can do pointer arithmetic in this fashion regardless of whether it is a host pointer or device pointer.

There is nothing magical about a device pointer in CUDA. It is a pointer that mechanically is identical to any other pointer in C or C++. A pointer is just a bare number. It only takes on meaning when you dereference it.