Allocating memory to custom data type?

Hello. I am completely new here. Here is my first question:

I have a class called vector3d which handles 3d spatial vector calculations for me in the form of 3 doubles (x, y, z). Therefore, the sizeof(vector3d) is correctly returned as 24 bytes, however, upon compiling my code I get the error:

no instance of overloaded function "cudaMallocManaged" matches the argument list
            argument types are: (vector3d (*)[10], unsigned long)

in reference to this line:

cudaMallocManaged(&vel, balls * sizeof(vector3d));

where vel is an array of type vector3d, vel[balls]. The issue appears to be something to do with how cudaMallocManaged uses the first argument, and I probably need to add something to my class to handle it. Any guidance?

When you are allocating a pointer using one of the CUDA allocation functions such as cudaMalloc or cudaMallocManaged, we don’t start with an array:

vector3d vel[balls];

we start with a pointer:

vector3d *vel;

If you still have trouble, show a short, complete code. In fact, I recommend that for all postings.