Now to my question. "m_myInt" and "m_ptr_myInt" have the same address "00F6FB50". Is this just a coincidence and the programm uses the same address since it can, or is there some connection between them, that I dont see?
If they are not connected, can I enforce the use of a different address? (Just out of curiosity)
When calling functions, parameters to that function are put onto the stack. When the function ends, that memory becomes available again. If you call another function, the parameters are put on the stack. In the same place the parameters to the previous function were placed.
It shows memory layouts as functions are called. You can see that if a function ends, and then another function is called, the parameters for that next function will go into the same memory location as the parameters for the function that just ended.
Not every system will use the memory in the same way, but it's pretty common.
When I add a variable "int test = 12345;" betwen my functions calls, is this variable also stored on the stack? But than after calling myFunction3, m_prt_myInt should be on a different address, which in practice isn't the case. Why is that?
When I add a variable "int test = 12345;" betwen my functions calls,
But when is the memory for that variable actually allocated? Typically, at the start of the function call, no matter where in the function the variable appears to be created.
So by the time you're calling these functions, that variable int test is already there on the stack because it was put there at the start of the call to the function main, so it has no effect on the memory address those function parameters occupy.