I just wrapped up the meat of the CUDA class “Fundamentals of Accelerated Computed with CUDA C/C++”, enjoyed it, and I pretty much followed it. But then I got to the final and there’s some syntax that I’m really struggling with. Full disclosure, I’m a neophyte C/C++ programmer.
int bytes = nBodies * sizeof(Body);
buf = (float *)malloc(bytes);
Body *p = (Body * ) buf;
What in the world is happening in the last two lines of code? “Body” is defined type that’s a struct with 6 floating point members.
I’ve been staring at this for hours. Thanks for any guidance!