I've almost got it now, but I can't figure out some segmentation error that I'm thinking is being created, likely by an indexing error I can't see for some reason, inside the overloaded [] operator...
Type: Posts; User: javapenguin
I've almost got it now, but I can't figure out some segmentation error that I'm thinking is being created, likely by an indexing error I can't see for some reason, inside the overloaded [] operator...
What do I delete?
delete[] newArray is causing weird things to happen.
Where should I put delete[] array or whatever I need?
Ok, delete[] array isn't working either.
What's the problem?
void AdjustArray::push_back(int m)
{
if(isFull() == true)
{
int* newArray;
newArray = new int[getSize() * 2];
int k;
for (k = 0; k < getSize(); k++)
...
He said to make the new array as the "current" one. I'm assuming array will point to newArray, but how do I get rid of the old space that array used to point to?
When do I type:
delete[]...
When I call delete[] in push_back, do I want to delete
array or newArray?
I know in the destructor it would be a good idea to delete array.
What's the difference between heap and stack?
int* newArray;
newArray = new int[getSize() * 2];
Is that right?
How'd you get four coffee cups?
The most I've ever seen is three before.
I thought I did use "new" in the constructor for AdjustArray.
Are you referring to when I set it to point to that larger array? If so, how would I do it then?
I have a spot where I'm worried that, since a silly IDE glitch won't let it run properly, perhaps as I don't have a makefile or put it in wrong package or something (new IDE/compiler).
Out:...