Search:

Type: Posts; User: tabstop

Search: Search took 0.10 seconds.

  1. Replies
    34
    Views
    29,106

    That is memory that you no longer want, so...

    That is memory that you no longer want, so freeing is appropriate.
  2. Replies
    34
    Views
    29,106

    That is what I meant, which is conveniently also...

    That is what I meant, which is conveniently also what the variable "data" in your function represents, so that's nice.
  3. Replies
    34
    Views
    29,106

    That is exactly what you want to do. However,...

    That is exactly what you want to do. However, you need to give the new memory to the person who is calling the function. You've created this new table data, which nobody outside this function is...
  4. Replies
    34
    Views
    29,106

    You can't delete data that you are expecting to...

    You can't delete data that you are expecting to actually continue to use. You can assign the pointer, that's fine; now you have two pointers pointing to the same place, so you can't free either of...
  5. Replies
    34
    Views
    29,106

    That sounds like a recipe for disaster.

    That sounds like a recipe for disaster.
  6. Replies
    34
    Views
    29,106

    You have to put the old one somewhere first in...

    You have to put the old one somewhere first in order to free it. "about_to_be_deleted" is a good name, I suppose.
  7. Replies
    34
    Views
    29,106

    "t->cell = " is generally the way you replace...

    "t->cell = " is generally the way you replace things.
  8. Replies
    34
    Views
    29,106

    In the sense that once you free(t->cell), your...

    In the sense that once you free(t->cell), your table ceases to exist, then that could be a problem. Perhaps you meant to replace t->cell with data and then free the old t->cell.
  9. Replies
    34
    Views
    29,106

    data[i] is a char *. t->cell[i] is a char**. ...

    data[i] is a char *. t->cell[i] is a char**. These are, as you may have noticed, different. They need to be the same.
  10. Replies
    34
    Views
    29,106

    I was thinking realloc/copying in place (instead...

    I was thinking realloc/copying in place (instead of the above malloc a new table and copy over) just because I have a bad habit of thinking "dynamic" = "large". But in any event, you never have more...
  11. Replies
    34
    Views
    29,106

    You shouldn't (necessarily) free the last row;...

    You shouldn't (necessarily) free the last row; you should free the row you want to remove. You can (and probably should) realloc the bunch-of-row-pointers if you want, but an extra pointer isn't...
  12. Replies
    34
    Views
    29,106

    Given the (completely traditional) way you were...

    Given the (completely traditional) way you were allocating your 2D matrix:

    deleting a row will be pretty easy -- you just have to reassign the row pointers after the deleted row (move them up one...
Results 1 to 12 of 12