Hopefully this isn't too basic of a question. I'm wondering if there's a difference between doing
while (1) {
int *a = new int(1);
// Do stuff with a
}
as opposed to
int *a;
while (1) {
a = new int(1);
// Do stuff with a
}
In both cases the same number of objects are dynamically allocated. But does the fact that the int keyword is used inside the loop in the first example affect the memory used?