Question: my question regrading to my homework for array and pointer and l did my research on YouTube to see l am if doing right or

my question regrading to my homework for array and pointer and l did my research on YouTube to see l am if doing right or wrong as the flow instruction:

Here are the main points that I want you to learn in this assignment: Understand the use of pointers and references. Study the example that I provide here. Demonstrate that you understand how to implement code with pointers. Copy/paste in the following code and compile it to verify that the IDE is working correctly. I have provided all of the code for this assignment

my question regrading to my homework for array and pointer and l

When you initially execute the code, just make sure it is working and free of errors. You should see the following output when you enter the identical inputs. Note that in this initial example, the output is undefined because the matrix addition is not in place.

did my research on YouTube to see l am if doing right

The Problem In this assignment, I don't want you to change any functionality. All I want you to do is change the implementation of the loop from iterating through the array to the use of a single pointer. The output will remain the same. This is not trivial, so it may take some research and please read the daily readings that I provide. Here is a major hint. After the array is created, simply create a pointer variable called pNumbers and use that to print the values of the array. int number[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; int *pNumbers = number; You will need to replace the code in red with the pointer. Don't use the array. cout

her what l did to replace the cout statement in the for loop with *pNumbers but what l do not understand is the last statement

Note that you will also have to do some simple pointer arithmetic to change the address of pNumbers. I will await your questions.

this the code that l did replace:

#include "stdafx.h"

#include #include using namespace std; int main() { cout

int number[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; int size = sizeof(number) / sizeof(number[0]); for (int i = 0; i

int *pNumbers = &number[0]; cout

and this the console output:

or wrong as the flow instruction: Here are the main points that

there is something wrong that l don't understand

#include iostream #include using namespace std; int main() int number]31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ; int size = sizeof( number ) / sizeof( number[0] ); for (int i = 0; i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!