Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

( Write statements to do the following i. Define two pointer types pl and p2 for pointer variables that contain pointers to int variables ii.

image text in transcribed
( 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions

Question

Find the orbital velocity for Uranus as it orbits the sun.

Answered: 1 week ago