I am trying to understand pointers, but I have issue with setting up the pointer especially to arrays. Like for example,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
int main()
{
int size;
int MM [2] = {1000, 0};
int *theG = NULL;
int *PMM = NULL;
cout << "\nPlease insert size of array:" << endl;
cin >> size;
theG = newint [size];
PMM [] = &MM; // Here I get an error.
findMM(&MM, &theG); //findMM is a function I haven't written yet.
delete [] PMM;
delete [] theG;
return 0;
}
Ultimately I am trying to figure out what I am doing wrong. :(
PMM [] = &MM; // Here I get an error.
That line doesn't really make any sense. The brackets don't make any sense at all, and any array can be assignable to a pointer, so you don't need the '&' operator.