Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

5:17 PM eecs.wsu.edu ull Verizon 98% ID#: Section #: Take Home: Quiz 5 (15 pts)

ID: 3722247 • Letter: 5

Question

5:17 PM eecs.wsu.edu ull Verizon 98% ID#: Section #: Take Home: Quiz 5 (15 pts) Pointers/Output Parameters 1. Given the following picce of code, provide the results of the printfs or assignment statements as requested. The comment indicates that you need to show the actual output of that print ) on that line. Assume that the variables "resul "numberl", and "number2" have addresses of, 1885020, 1885032, and 1885044, respectively. The first line has been do you. Each line is worth 2 points (yes, you receive 1 free pt include cstdLo.h> void integer-multiplication Kint ·res, int .manl, int ·man2); int, ain (void) print f print f "re5u 1 t: Sd, Nunber1: "Addresses of Result: Sd, 3d, Namber2: Naaber1: %d ", result, number1, nurber2); 9d. Number2: bdin", &result;, 6nuaber1" *blank 1- blank 2 &mumk; 39 /*blank /"blank / Integer rultipllcation (Gresult, nuni ptr, nun2 ptr) printf print f

Explanation / Answer

Answer:

Given we have to assume the addresses of result, number1 and number2 is 1885020, 1885032, 1885044

/*blank 1*/ Result: 0, Number1: 5, Number2: 9

/*blank 2*/ Addresses of Result : 1885020, Number1: 1885032, Number2: 1885044

/*blank 3*/ Actual content of num1_ptr: 5

Actual content is the value *num1_ptr holds in its address 1885032

/*blank 4*/ Actual content of num2_ptr: 9

Actual content is the value *num2_ptr holds in its address 1885044

/*blank 5*/ Addresses of Result : 1885020, Number1: 1885032, Number2: 1885044

/*blank 6*/ Result: 45, Number1: 5, Number2: 9

Here result is printed as 45 because the function integer_multiplication, the result value changes as 45.

/*blank 7*/ Res: 1885020, Num1: 1885032, Num2: 1885044

In the function integer_mutliplication we pass *res, *num1, *num2 pointer variables as parameters. As pointer variables refer to memory locations, it prints the address locations.

/*blank 8*/ Result of multiplying 5 by 9 is 45

The result becomes 45 after mutliplying number1 and number2 in the function.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote