I am going mental, boiled something down to simple, no matter how or what i try, an array will not work? whats up?
The code is simply a single cpp helloworld from cocos2dx. nothing more,
double *Array = new double[333];
if (Array == nullptr)
CCLOG("Error: memory could not be allocated");
//initialize it
for( int i = 0; i != 333; ++i){
Array[i] = 333 - i;
}
for( int i = 0; i != 333; ++i){
CCLOG("Hi %ld", Array[i] );
}
The loop always prints 0....
Ive tried many loops, test, the array is never array. its ALWAYS just an int, or double, or whatever type of array i try?
Any thoguhts?
VS2012 cocos2dx helloworld stripped to nothing but an array now. Windows 10
CCLOGformatting wrong.CCLOG, trycout << Array[i] << "\n";(orprintf ("%ld\n", Array[i]);if you prefer).if (Array == nullptr)will always befalse, becausenewthrows an exception if it fails.new, do consider usingstd::vector. It takes care of the memory management for you, and is resizable and copyable.