我使用下面的代码来设置浮点数组的值
#include "math.h"
#include "string.h"
#include <stdio.h>
#include <stdlib.h>
class MathCore
{
public:
MathCore();
virtual ~MathCore( );
bool dosomething ( );
};
和
#include "MathCore.h"
MathCore::MathCore()
{
}
MathCore::~ MathCore()
{
}
bool MathCore::doSomething ( )
{
//-------------------------------------------------
float *xArray;
xArray=(float*)malloc(sizeof(float)*5);
float v=0.1;
xArray[0]=v;
return 1;
}
它总是报告 EXC_BAD_ACCESS 错误
xArray[0]=v;
欢迎您的评论