Memory and Pointers

Hello i have a program to solve, i am quite good in reverse engineering...that is i will understand the program more efficiently when i have it solved.
kindly help me to, below is a small program regarding memory and pointers in C++

Last edited on
to allocate memory you do this in C++

 
doubleArray = new double[ARRAY_SIZE];


and for the deallocating part and setting to NULL you should do this

1
2
delete[] doubleArray;
doubleArray = NULL;


This is the old way for some.

There is the new unique_ptr and other kind of ptr. Well, I don't really know much about them so I can't explain to you about it.
From what I know those pointer doesn't need cleaning up as they clean up on destruct
By the way, why would you do

 
doubleArray[i] = double(i)


you can just fill it after array allocation

 
doubleArray[i] = i;
thankyou so much for your prompt reply, much appreciated :)
Topic archived. No new replies allowed.