Originally Posted By: txesmi
I think the better choice is to direcly use the new string instead of copying it to another but it depends on the rest of the code xP

Code:
STRING *strResult = new_string ( "hello" );
...
str_remove ( strResult );



Quote:
And do I really need to delete it in order to save some memory?

Yes. Totalmente. Every object has to be deleted before exiting.

Salud!
txesmi@ thank you again man! This explains a lot! laugh

Originally Posted By: Wjbender
http://www.programmerinterview.com/index.php/data-structures/difference-between-stack-and-heap/
I am coming off as confusing most likely but I tried.

what becomes confusing here is the word "create"
because , depending on how the created object gets created makes a difference ,if the called function creates the object on the heap you take care of it , if it is on the stack it wil be taken care of as soon as the function that called the "create function" runs out ,I mention this because not all functions that create objects are written the same eg.

you may find a function that is written to create on the heap but called localy within another function ..
Wjbender@ thank you for the useful link, that will be very useful for me to learn from laugh

I have one more question guys, still about memory issues but this time about structures.
What will be the best way to remove a structure once we don't need it?
I've seen in some examples people use 'free()', is that a good way to go?

Thank you all once again laugh

Greets


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung