3. Assume the definitions and initializations (8 points): char c = \'T\', d = \'
ID: 3549605 • Letter: 3
Question
3. Assume the definitions and initializations (8 points):
char c = 'T', d = 'S';
char *p1 = &c;
char *p2 = &d;
char *p3;
Assume further that the address of c is 6000, the address of d is 7004. What will be printed when the following statements are executed sequentially?
p3 = &d;
cout << "*p3 = " << *p3 << endl; // (1)
p3 = p1;
cout << "*p3 = " << *p3 // (2)
<< ", p3 = " << p3 << endl; // (3)
*p1 = *p2;
cout << "*p1 = " << *p1 // (4)
Output:
Explanation / Answer
*p3 = S *p3 = T, p3 = 6000 *p1 = S
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.