Reputation: 10971
when I defined two float arrays like this:
float* d_A, d_B;
cudaMemcpy(d_B,h_B,size,cudaMemcpyHostToDevice);
I receive an error concerning array d_B
argument of type "float" is incompatible with parameter of type "void *"
if I defined the arrays like this:
float* d_A;
float* d_B;
it works fine and the error disappears. what can be wrong here ? I'm using NSight Visual Studio edition version 3.2
Upvotes: 2
Views: 4324
Reputation: 61477
The *
specifing the pointer belongs to the variable, not the type. So to initialize it on the same line, use
float *d_A, *d_B;
Putting the *
next to the variable with no space makes it much more obvious as well.
Upvotes: 6