Created
August 16, 2018 17:23
-
-
Save 22shubh22/04a873988f2a317224c534828d22011f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Please do not run the program, but draw the memory picture to determine the output. | |
void Unknown(int *p, int num); | |
void HardToFollow(int *p, int q, int *num); | |
void Unknown(int *p, int num) { | |
int *q; | |
q = # | |
*p = *q + 2; | |
num = 7; | |
} | |
void HardToFollow(int *p, int q, int *num) { | |
*p = q + *num; | |
*num = q; | |
num = p; | |
p = &q; | |
Unknown(num, *p); | |
} | |
main() { | |
int *q; | |
int trouble[3]; | |
trouble[0] = 1; | |
q = &trouble[1]; | |
*q = 2; | |
trouble[2] = 3; | |
HardToFollow(q, trouble[0], &trouble[2]); | |
Unknown(&trouble[0], *q); | |
cout << *q << " " << trouble[0] << " " << trouble[2]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment