hey people just have another quick pointer question when I assign a pointer to an array with the first line of code does this create a pointer to the size for the array in other words is it just one pointer that points to the first address of the array or is it an array of pointers with each array pointer pointing to each element of the array?
int foo[3] = {3, 9, 27};
int *ptr;
ptr = foo; // store the memory address of foo
cout << ptr[0] << '\n';
cout << ptr[1] << '\n';
cout << ptr[2] << '\n';
Pointers are specialized in storing the memory addresses of other variables. And unlike arrays, pointers are more flexible you can make them point to different variables of your choices. You can also perform some certain arithmetical operations (e.g : '+', '-', '+=', '-=') when you operate with pointers.
There also shouldn't be 2 topics about essentially the same subject. There is a risk that the same things will be said in both, possibly making it a time waster for those who reply.