Original Post
Hey! I've been reading this book, by Stephen Prata and everything is fine, but there is some things I wonder about... If I for example do: char *ptr = new char; I need to delete it when im done, that will give back the memory to the pool, but... I've seen this in an example in the book: char *ptr = "hello"; The book explains why it works but my question is; why dont I have to use delete on that pointer? At least the book doesnt do it. What happends with the memory it uses when the function it is in is done? And what happends with: char *ptr2 = "hello"; ptr2 = "hey"; What happends with the string "hello"? is it automatically deleted, and the memory given back? or is that wasted memory? Also, what about... int *ptr; ... { // THE block int a = 2; ptr = &a } From outside the block, can I use a? can I use *ptr? Can I even do that? Thanks in advance!