Dynamic Memory Issue

So i've just gotten around to researching dynamic memory allocation and it could be that its 4am but im confused.

http://pastebin.com/gC7hQeuF

In the function expand(), i have absolutely no idea why that for loop works. When it runs the first time should it not evaluate to false? On the first run through the loop i = 0 and length = 0, so how can i < length evaluate to true and run the loop? If i put i <= length it gives me an access violation error.

Thank you for any help in advance
It doesn't run the for loop the first time.

All the for loop is doing is copying the old array to the new array, the first time there is nothing to copy so it doesn't matter.
Yep i should get some sleep :D. Thank you.
Last edited on
Topic archived. No new replies allowed.