Don't really understand what the new operator does. My books say it's a memory allocation operator which makes perfect sense, but does it simply free up memory to store a placeholder for a pointer? If so, what is the usefulness of reserving memory instead of just initializing a pointer and thus using the necessary amount of memory? What is the essential difference between:
Code:
int x = 100;
int *p = &x;
//do stuff
delete p;
and
Code:
int x = 100;
int *p = new int; //really not too sure about this syntax, do you need to specify the type of the pointer when using new?
//…
*p = &x;
//do stuff
delete p;
If your program needs pointers to hold memory addresses, why don't you just initialize the pointers when they are needed? Maybe I just have no idea what new does.