Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can anyone help me with this code? it says that is something wrong with the \"&\

ID: 3646589 • Letter: C

Question

Can anyone help me with this code? it says that is something wrong with the "&" in this line:

copyfunc(&miles, arraynumb);

Thanks!

---------------------------------------------------------------------------------------


#include <iostream>
using namespace std;


const int arraynumb = 7; // declaration of keys: number of characters of keys
void copyfunc(int *[], int); // function initialized
int main()
{

int miles[arraynumb] = {15, 22, 16, 18, 27, 23, 20};

copyfunc(&miles, arraynumb);

return 0;


}
void copyfunc(int *arrayAddr[], int numels)
{

int i, dist[arraynumb];
int copy;

for(i=1; i < arraynumb; i++)
copy = *arrayAddr[i];
dist[i] = copy;
cout << (dist[i]) << endl;

// cout << (dist[i] = *arrayAddr) << endl;

return;
}

Explanation / Answer

copy = *arrayAddr[i]; is right try to right void copyfunc(int arrayAddr[], int numels) as void copyfunc(int* arrayAddr, int numels); it will give you required result surely,

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote