comment from a book: “ With dynamic memory allocation, however, the compiler doesn’t know how much storage you’re going to need, and it doesn’t know the lifetime of that storage. That is, the storage doesn’t get cleaned up automatically. ”
I don’t fully understand above statement.
If I say:
Does that mean the compiler do not know that I want 100 new bytes?Code:new unsigned char;
And what’s the meaning of that the compiler doesn’t know the lifetime of that new storage? If I create a variable using new inside a function, isn't it's life time is that function?
Thanks a lot.