I asked my friend a question to see what kind of programmer he is. He's the kind of programmer that just wants it to run, and let the OS take care of any system problems.
So I asked him what about memory leaks, like if a pointer (in practical use) was to be moved around and all that. He said everything would be destroyed once the program was shut down, so he doesn't spend the time worrying about those things.
I have been doing C programming and memory leaks weren't that big of a deal since you can't just have a pointer pointing to an object, a variable had to exist, except for using files. In that case, once the file was closed you must set the pointer to NULL.
I got this book for C++, and I just learned I could set a pointer to an object using new. Then it said if I did not delete the object, and I moved the pointer, there would be a memory leak:
Code:
/*
creates memory leak
*/int *pint=new int(1024);
int var=241;
pint=&var;
So now I'm wondering, would the memory not be cleared once the program is terminated because it's no longer associated with the program? Or will it be fine?