Error Message for cudaMemcpy

worker1 = (unsigned char ) malloc(sizeof(unsigned char) * 512);
cudaMalloc(&worker1_d, 256
sizeof(unsigned char));

worker1[i] = vec[i];

-------------------------Error Message for cudaMemcpy------------------------------------>

Multiple markers at this line
- Syntax error
- expected a “)”
- this declaration has no storage class or type specifier
- declaration is incompatible with “cudaError_t cudaMemcpy(void *, const void *,
size_t, cudaMemcpyKind)”
- a value of type “unsigned char **” cannot be used to initialize an entity of type “int”


cudaMemcpy(&worker1_d, worker1, 512*sizeof(unsigned char), cudaMemcpyHostToDevice);

Hi I have an unsigned char array that is added to worker1 using the simple for loop above, I then want to copy worker1 to worker1_d for cuda processing but the cudaMemcpy is causing an error, I have re-wrote it many times but cant get the syntax right.

any idea’s appreciated.