That is memory that you no longer want, so freeing is appropriate.
Type: Posts; User: tabstop
That is memory that you no longer want, so freeing is appropriate.
That is what I meant, which is conveniently also what the variable "data" in your function represents, so that's nice.
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...
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...
That sounds like a recipe for disaster.
You have to put the old one somewhere first in order to free it. "about_to_be_deleted" is a good name, I suppose.
"t->cell = " is generally the way you replace things.
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.
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.
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...
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...
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...