Task 8. 1. Give the values of the variables after these statements are executed: a) int a-1, b-2,…

Task 8. 1. Give the values of the variables after these statements are executed: a) int a-1, b-2, “ptr=&b; a ptr; b). int a 1, b-2, c=5, ptr=&c; b ptr “ptr a c). int a-1, b-2, c-5, “ptr; ptr=&c c = b a ptr d). double x=15.6, y 10.2, “ptr_1=&y, *ptr_2=&x; ptr_1 ptr_2+x; e) int w 10, x-2, “ptr_2=&x; ptr_2 = w; Task 8.2 Show the contents of the variables that have changed after executing each of the following codes, here m is name of an array 10, p1, *p3 ; int i int m[{2,4,8,9,12,32,78,54,98}; a) p1 &i; *p1 8 = b) p1 &m[0]; p1 p12 *p1 *p18; + c) p1 &i; p3 m *(p3 1) p3 + *p1; d) p1 m2; p3 p11 i p1p3; Task 8.3 Assume that an array m is defined with the following statement: int m[(10,2,4,5,2,1, 20, 34}; int *ptrl-&m[0], *ptr2=&m[2]; Give the value of the following references 1. m 2. (m+1) 3. m+5 4. (m+5) 5. *ptr1 6. *ptr2 7. *(ptr1+1) 8. *(ptr2+3) Task 8.4 Assume that an integer array m is defined by the following statements: int m[2][5]={{1,8,7,6, 10}, {2,4, -1,0, 5}}, “p-&m[0][0]; Draw a memory allocation diagram, and give the value indicated by each of the following references: 1. *p 2. (p+2) 3. *p2 + 4. *(p+1)*(p+5)

 

Looking for a Similar Assignment? Hire our Top Uk Tutors while you enjoy your free time! All papers are written from scratch and are 100% Original. Try us today! Active Discount Code FREE15