I’m having a slight issue and not quite understanding the syntax for what I’m wanting to do. See below:
float* ParticleSystem::GetMinLifeTime()
{
return &minLifeTime;
}
I’m wanting to declare a dynamic array and then change the value of element 0 to point to the minLifeTime memory location. MY attempt so far has been:
float* lifeTimeNumbers = new float[LIFETIME_STRINGS_SIZE];
lifeTimeNumbers[0] = *activeParticleSystem->GetMinLifeTime();
My understanding though is that I’m dereferencing the values when adding them to the array. This isn’t what I’m wanting. I’m really wanting to change the memory location of lifeTimeNumbers[0] to the memory location returned by GetMinLifeTime(). Can I do such a thing?
Cheers
you can’t change the address of [0] of the array as the array is basically ONE area of memory and not a number not individual pointers.
Your ‘isssue’ could be done using a **.. then you could have [0] store a pointer to the value