QUOTE(help-linux @ 1 Sep, 2006 - 07:45 AM)

the code i posted was just an example, here you go:
CODE
char hello[100];
hello = "hello world";
cout << hello << endl;
//never use hello again
i justr want to know in general how to free up as much memory as possible.
hello = "hello world";I don't think this would compile...You'll need strcpy() to set the contents. Otherwise you get an LValue Required Error.
QUOTE(Nova Dragoon @ 1 Sep, 2006 - 07:54 AM)

hello should be freed up as it goes out of context,
You are kinda right.
I disassembled the file and checked it out.
The new and delete operators call malloc() and free() to explicitly allocate/deallocate memory,
Mrafcho001's code doesn't do any of that, but rather loads the string offset in a register and is pushed onto the stack.
But the stack is cleared before the main() fn goes out of scope.
So it doesn't cause a memory leak.
Although using Data Structures without memory allocation will result in it.