[Solved] Difference of variable initialization in C++ [duplicate]
“Is there any difference between these 2 ways of storing an integer?” Yes, there is a significant difference. int X = 100; Initializes a variable X on the stack with the value 100, while int *pX = new int(100); allocates memory for an int on the heap, kept in pointer pX, and initializes the value … Read more