Explanation of Solution
The program has been explained in the in-lined comments:
#include <iostream>
using namespace std;
int main()
{
//declare int pointers
int *intArrayPtr;
int *temp;
//creates an array of five components of type int and
//stores the base address of the array
//into the pointer intArrayPtr
intArrayPtr = new int[5];
//contents of the base address of the array is
//assigned a value of 7 i.e. intArrayPtr[0] is 7
*intArrayPtr = 7;
//temp is assigned the value of intArrayPtr
//so it also points to array base address
//i.e. intArrayPtr[0]
temp = intArrayPtr;
//modify the contents of the array inside for loop
for (int i = 1; i < 5; i++)
{
//increment pointer to the next address
//i.e. next element in the array
intArrayPtr++;
//assign the value of the current element
//pointed to by intArrayPtr with the value
//on RHS ...
Want to see the full answer?
Check out a sample textbook solutionChapter 12 Solutions
C++ PROGRAMMING LMS MINDTAP
- int func(int a, int b) { return (aarrow_forwardint main() { int inStock[10][4]; int alpha[20]; int beta[20]; int gamma[4] = {11, 13, 15, 17}; int delta[10] = {3, 5, 2, 6, 10, 9, 7, 11,1, 8};. . .} a. Write the definition of the function setZero that initializes any onedimensional array of type int to 0. b. Write the definition of the function inputArray that prompts the user to input 20 numbers and stores the numbers into alpha. c. Write the definition of the function doubleArray that initializes the elements of beta to two times the corresponding elements in alpha. Make sure that you prevent the function from modifying the elements of alpha. d. Write the definition of the function copyGamma that sets the elements of the first row of inStock to gamma and the remaining rows of inStock to three times the previous row of inStock. Make sure that you prevent the function from modifying the elements of gamma. e. Write the definition of the function copyAlphaBeta that stores alpha into the first five rows of inStock and beta into the…arrow_forward#include using namespace std; int main() (double degree [6] [2] = {30,40,10,70, 20, 30, 60, 70, 30, 10, 10, 85); int buffer=degree[0][0]; for (int i=1;ibuffer) buffer=degree[i][0]; cout using namespace std; int main() { int j=1; while (j<=10) if ((j%3)==0) cout<arrow_forwardsum = 0; for (int i = 1; i< n; i = sum++ || 2*i)arrow_forwardadd explanationarrow_forwardvoid mystery2(int list[], int length) { for (int i = 0; i < length - 1; i++) { if (i % 2 == 0) { list[i]++; } else { list[i]--; } }} For each array below, indicate what the array's contents would be after the function were called and passed that array as its parameter. use the following as input. {6, 3} {2, 4, 6} {1, 2, 3, 4} {2, 2, 2, 2, 2} {7, 3, 2, 0, 5, 1}arrow_forward#include using namespace std; int main() (double degree [6] [2]= (30,40,10,70, 20, 30, 60, 70, 30, 10, 10, 85); int buffer=degree[0][0]; for (int i=1;ibuffer) buffer=degree[i][0]; cout<arrow_forwardii) Explain what the code does step by step.arrow_forwardExplain following code segment:int [] a = new int [3];int [] b = new int [3];a = b;arrow_forwardc++ coding language I need help with part B and C please. If you are unable to do both, then PLEASE prioritize part C. I am really stuck and really can use the help. This is the code for c that was provided in order to guide me: const int N =31; // N parking spaces bool parking[N]; // the garage void EmptyTheLot(bool parking[], int N) { for(int i=0; i<N; i++) p[i]=false; // empty space } // returns -1 if no space found, //otherwise it returns 0<=i<N for a valid space. int FindSpace(int PlateNumber, bool parking[], int N) { // ????? } main() { EmptyTheLot(parking, N); // start with an empty parking garage. // get plate numbers and fill lot. }arrow_forwardCFG: Example 1 • Draw the CFG for the following code: int f(int n){ } int m = n* n; if (n < 0) else return 0; return m;arrow_forwardjavaarrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_iosRecommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSONC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education