Question: I have the following pointer:

```
jfloat *verticesLocal;

```

And I want make a new copy to:

```
jfloat *vertices;

```

I want to copy the values from `verticesLocal` to `vertices`.

How can I do that? I've just tried the following command, but it doesn't work:

```
memcpy(vertices, verticesLocal, numVerticesLocal * sizeof(jfloat));

```

I can't see the error because I'm working with Android native code. Sorry.

Answer: 
`malloc` first, then do your `memcpy`.
this is how you copy an **array buffer** :

```
    unsigned char *pBufferSrc = new unsigned char[10];  
    unsigned char *pBufCpd = new unsigned char[10];

    for (int i = 0; i < 10; i++)
         pBufferSrc[i] = i;        // pBufferSrc = [0,1,2,3,4,5,6,7,8,9]

     memcpy(pBufCpd, pBufferSrc, 10);   // data from pBufferSrc is copied to pBufCpd (0,1,2,..9)

     delete []pBufferSrc;       // if even pBufferSrc buffer gets deleted, pBufCpd still has the data

```