can anyone help me with this code it says that is some thing wrong in this line:
ID: 3646591 • Letter: C
Question
can anyone help me with this code it says that is some thing wrong in this line: " copy = *arrayAddr[i]; "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,
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.