tps: aa8tbynz0s1 ypjeqgnjag3vg2 0 CSF 2421 SP 2018 Homework 1.pdf?AMSA essKolds
ID: 3880775 • Letter: T
Question
tps: aa8tbynz0s1 ypjeqgnjag3vg2 0 CSF 2421 SP 2018 Homework 1.pdf?AMSA essKolds AKIAIEDNRIJ4AZKBW6HA&Expires;#15172986738 Signaturesq qH9EN 0 Due:Tuesday, Jaruary 30, 2015 at the beginning of dlass-Early submissions are allowable athouch no bonus awarded for this hemework Late submissions accepted for up to 24 hours after due date with 25% penalty Nil of these exercises are to be completed without the use of any electroric devices. if you choose to igrdro this requirement, know thyou will ikely have exereses very emilar to those below tn the f-d-term where no electronic devices wil be permitted So you tan learn how to manually solve these types cf problems whle doire ths homework f while you are taking your mid-term. uirement, know that int w, x-21, y-6,2-12 nt int ptr Using the in-dlas example from side deck?as a model, wha does each of the statements below do? What is te final B valesofs? What is the final 9 valkas ofy 0 val of aExplanation / Answer
int w,x=21,y = 6,z = 12;
int *int_ptr;
1. int_ptr = &x;
int_ptr is assigned the address of variable x.
2. w = *int_ptr;
The value at int_ptr is assigned to variable w. So w = 21(value of x).
3. *int_ptr = y;
value at address int_ptr = y . So x = 6(value of y)
4.int_ptr = &y;
int_ptr will store the address of variable y.
5. *int_ptr = z;
value at pointer address int_ptr = 12(value of z). So y = 12
6. int_ptr = &w;
int_ptr now contains the address of w.
7. x = *int_ptr;
x = 21 as int_ptr now contains the address of w.
8. Final value of x = 21
9. Final value of y = 12
10. Final value of z = 12
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.