I need questions 11-20: CS 3733 : Homework/Practice -01: reviews of pointers You
ID: 3875869 • Letter: I
Question
I need questions 11-20:
CS 3733 : Homework/Practice -01: reviews of pointers You can get help on this from any source you wish (other than faculty) as long as you understand the answers that you submit. In the figure below, the numbers 1000, 2000, 3000, 4000, and 5000 represent addresses in decimal. The w, x, y1, y2, y3, y4, and z represent values stored in 4 bytes of memory. Assume that pointers take up 4 bytes. The variable argvp is declared by char ""argvp; Find the value of each of the following or state that it cannot be found from the given information (?) None of the answers should be w, x, y1, y2, y3, y4, or z. Instead, use their numeric values Hint: The answer to the first question is 2000 3) y1 4) y2 6) y4 8) argvp 9) &argvp; 10) "argvp 11) argvp 12) argvp 13) argvp+1 14) "(argvp+1) 15) (argvp)+1 16) "((argvp)+1) 17) argvp[1] 18) ('argvp)l1 19) (argvp[1) 20) argvp[1]10] ar 1000 2000 y1 30o0 y2 y3 y4 NULL 40 2 5000Explanation / Answer
EXPLANATION: y1,y2,y3,y4 and z are character pointers i.e. they store the address of a character value. x is a pointer to character pointer i.e it stores the address of character pointer and argvp is the pointer to pointer to character pointer i.e. it stores the address of pointer which stores the address of character pointer. Now, according to pointer arithmetic, if add an integer to a pointer, it increases its value by 1(because it is of char type), while the x and argwp will change their values by 4.
As it is clear from the figure,
y1=z=4000
hence x = 3000
argwp = w = 2000, argwp is stored at address 1000, &argwp = 1000. *argwp=x=3000. **argwp = *x = y = 4000.
***argwp = **x = *y = 'm'.
Rest questions are self explanatory.