I'm a bit confused about the difference between when I just declare a variable such as:
int n;
and dynamically assigning memory to a variable using "new" such as:
int m = new int;
I noticed just from working on a simple linked list project that when I'm inserting a new value in the form of an node object, I have to dynamically create a new node object and append the desired value to it and then link it to the rest of my list. However.. in the same function, I could just define another node object, ex. NodeType *N. and traverse my list using this pointer. My question is.. when we just declare a variable, does memory not get assigned right away.. or what's the difference?
Thank you!