KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Why is 90 the output value of y and q ? I just do p=q . How come the value of q is changed? int main() { int x; int y; int *p = &x; int *q = &y; x = 35; y = 46; p = q; *p = 90; cout << x << " " << y << endl; cout << *p << " " << *q << endl; cout << "Address of p = " << p << endl; cout << "Address of q = " << q << endl; return 0; } The output is: 35 90 90 90 Address of p = 0xbffa83c0 Address of q = 0xbffa83c0
Tags (comma-separated)
Save Edits
Cancel