I'm trying to make some ROT13 encoder with CUDA, but I have problem with passing char array to kernel. Could anyone tell me what I'm doing wrong?
#include <iostream>
#include <conio.h>
#include <string>
#include <cuda.h>
#define CIPHER_NUMBER 13
using namespace std;
__global__ void ROT13(char* text, int length)
{
    for (unsigned int i = 0; i < length; i++)
    {
        if ((text[i] >= 'A' && text[i] <= 'M') || (text[i] >= 'a' && text[i] <= 'm'))
            text[i] += CIPHER_NUMBER;
        else if ((text[i] >= 'N' && text[i] <= 'Z') || (text[i] >= 'n' && text[i] <= 'z'))
            text[i] -= CIPHER_NUMBER;
    }
}
int main()
{
    char* text = "Hello world!";
    char* d_text;
    cudaMalloc(&d_text, sizeof(char*));
    cudaMemcpy(d_text, &text, sizeof(char*), cudaMemcpyHostToDevice);
    ROT13 <<<1, 1>>>(d_text, 12);
    cudaMemcpy(&text, d_text, sizeof(char*), cudaMemcpyDeviceToHost);
    cout << "The answer is: " << text << endl;
    cudaFree(d_text);
    getch();
    return 0;
}
Console should print: "Uryyb jbeyq!", but it prints: "Hello world!".
 
     
    