i have a class called Product.
Each product has a value and i want to add these values on GPU. I filled my array on host side
int * h_A, * d_A;
    h_A = (int*) malloc(enterNum * sizeof(int));
    cudaMalloc((void **) &d_A, enterNum * sizeof(int));
    Product p("Product", price);
    h_A[i] = p.getValue();
    while (i < enterNum) {
        i++;
        cout << "Enter product name:";
        cin >> desc;
        cout << "Enter product price:";
        cin >> price;
        Product p("Product", price);
        h_A[i] = p.getValue();
    }
    cudaMemcpy(d_A, h_A, enterNum, cudaMemcpyHostToDevice);
    priceSum<<<enterNum, 1024>>>(d_A,enterNum,result);
    int  result2 = 0;
    cudaMemcpy(result, result2, enterNum, cudaMemcpyDeviceToHost);
here cudaMemcpy function gives error because i dont use pointer. What can i do here? I dont need to use pointer here isn't it?
this is my summation function:
__global__ void priceSum(int *dA, int count, int result) {
    int tid = blockIdx.x;
    if (tid < count){
        result+= dA[tid];
    }
}
full code:
using namespace std;
#include "cuda_runtime.h"
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <stdlib.h>
class Product {
private:
    char * description;
    int productCode;
    int value;
    static int lastCode;
public:
    Product(char* descriptionP, int valueP) {
        productCode = ++lastCode;
        value = valueP;
        description = new char[strlen(descriptionP) + 1];
        strcpy(description, descriptionP);
    }
    Product(Product& other) {
        productCode = ++lastCode;
        description = new char[strlen(other.description) + 1];
        strcpy(description, other.description);
    }
    ~Product() {
        delete[] description;
    }
    char* getDescription() const {
        return description;
    }
    void setDescription(char* description) {
        this->description = description;
    }
    int getValue() const {
        return value;
    }
    void setValue(int value) {
        this->value = value;
    }
};
int Product::lastCode = 1000;
__global__ void priceSum(int *dA, int count, int * result) {
    int tid = blockIdx.x;
    if (tid < count)
        result+= dA[tid];
}
int main(void) {
    int enterNum, price, * result = 0;
    string desc;
    const char * desc2;
    cout << "How many products do you want to enter?";
    cin >> enterNum;
    int * h_A, * d_A;
    h_A = (int*) malloc(enterNum * sizeof(int));
    cudaMalloc((void **) &d_A, enterNum * sizeof(int));
    int i = 0;
    while (i < enterNum) {
        cout << "Enter product name:";
        cin >> desc;
        cout << "Enter product price:";
        cin >> price;
        Product p("Product", price);
        h_A[i] = p.getValue();
        i++;
    }
    cudaMemcpy(d_A, h_A, enterNum * sizeof(int), cudaMemcpyHostToDevice);
    priceSum<<<enterNum, 1>>>(d_A,enterNum,result);
    int  result2 = 0;
    cudaMemcpy(&result2, result, enterNum, cudaMemcpyDeviceToHost);
    cout << result2;
    return 0;
}
 
    