Android SIGSEGV 数组错误

Android SIGSEGV error with array

我在 Android 中遇到本机代码问题。

我使用这段代码用向量中的内容填充数组

float * Map_Loader::ConvertToArray()
{
    float *arr = new float[(faces.size() -1)*3];
    int index = 0, j = 0;
    while(index < faces.size())
    {
        arr[ j ] = faces[ index ].vertex[ 0 ].x;
        arr[ j +1 ] = faces[ index ].vertex[ 1 ].y;
        arr[ j +2 ] = faces[ index ].vertex[ 2 ].z;
        j += 3;
        index++;
    }
    return arr;
}

我使用这段代码创建指针并从函数中获取值:

float *x = Map.ConvertToArray();

它在 windows 工作,但在 android 我有问题..

此致

我明白了!!

答案代码必须是这样的:

float *x;
x = Map.ConvertToArray();

谢谢大家 ;)