1. Engineering
  2. Computer Science
  3. write statements to do the following i define two...

Question: write statements to do the following i define two...

Question details

( Write statements to do the following i. Define two pointer types pl and p2 for pointer variables that contain pointers to int variables ii. Declare two int variables a and b and initialize b to 100 i Let pl point to b. iv. Dynamically allocate an integer variable and store its address in p2 v. Divide the value that pl is pointing to by 4 and assign the result to a vi Assign the result of b divided by a to the variable that p2 is pointing to vii. Define an int pointer p3 vii Let p3 point to a ix. Assign the value of the variable that p2 is pointing to, to the variable that p3 is pointing to. x. Add 6 to variable a xi. Assign twice the value of the variable that p3 is pointing to, to the variable that pl xii Let p1 point to the same variable as p2 is pointing to xii What is the value of the variable that pl is pointing to at this stage? (Hint: Add statements (i)- (xi) in a C++ program and display the value of the variable in question) xiv. Free the memory allocated to the variables that pl, p2 and p3 are pointing to
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution