The output prints the same value - 8; I am not able to get why *p = 15 does not modify the the pointers value?
void foo(int *p) {
    int q = 19;
    p = &q;
    *p = 15;
}
int main() {
    int x = 8;
    int *y = &x;
    foo(y);
    cout << x << " " << *y << endl;
    cin.get();
}
 
     
     
    