Given the following code snippet:
#include <iostream>
using namespace std;
int *pPointer;
int func()
{
    int num;
    num = 25;
    pPointer = #
}
int main()
{
    func();
    cout << *pPointer << endl;
    cout << *pPointer << endl;
    return 0;
}
Can anyone tell me if I duplicate the following line:
cout << *pPointer << endl;
cout << *pPointer << endl;
Why I receive 25 (as expected) but then the next value is 0 (NULL)?
Wouldn't the value of int=25 still remain on the stack? What is it about cout that changes the value of pPointer? Am I missing something about my understanding about scope and the stack? (I'm a Java guy, so this was surprising).
 
     
     
     
     
     
    