Write C++ statements to do the following: (7) (i) Define a pointer type int_ptr for pointer variables that contain point
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Write C++ statements to do the following: (7) (i) Define a pointer type int_ptr for pointer variables that contain point
Write C++ statements to do the following: (7) (i) Define apointer type int_ptr for pointer variables that contain pointers toint variables. (ii) Declare p2 to be a pointer to an int. (iii)Obtain an integer value nrElements from the user indicating thenumber of elements to allocate. (iv) Dynamically allocate an arrayof nrElements integers and store its address in p2. (v) Declare anint array a with 500 elements. (vi) Assume p2 has been initializedand copy the elements of p2 one by one to the correspondingelements in a. (vii) Free the memory allocated to the variable thatp2 is pointing to