Search:

Type: Posts; User: javapenguin

Search: Search took 0.09 seconds.

  1. Re: Have a C++ project due soon and am not sure if I'm using pointers right.

    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...
  2. Re: Have a C++ project due soon and am not sure if I'm using pointers right.

    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?
  3. Re: Have a C++ project due soon and am not sure if I'm using pointers right.

    void AdjustArray::push_back(int m)
    {

    if(isFull() == true)
    {
    int* newArray;
    newArray = new int[getSize() * 2];
    int k;
    for (k = 0; k < getSize(); k++)
    ...
  4. Re: Have a C++ project due soon and am not sure if I'm using pointers right.

    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[]...
  5. Re: Have a C++ project due soon and am not sure if I'm using pointers right.

    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.
  6. Re: Have a C++ project due soon and am not sure if I'm using pointers right.

    What's the difference between heap and stack?

    int* newArray;
    newArray = new int[getSize() * 2];

    Is that right?
  7. Re: Have a C++ project due soon and am not sure if I'm using pointers right.

    How'd you get four coffee cups?

    The most I've ever seen is three before.
  8. Re: Have a C++ project due soon and am not sure if I'm using pointers right.

    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?
  9. Have a C++ project due soon and am not sure if I'm using pointers right.

    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:...
Results 1 to 9 of 9