Given the following code what is the difference between ptr and ptr2? because size of v is 20 whereas size of &v[0] is 4. Why does this even work? Why not a third pointer like ptr* = &v. All of these have the same base address but what is the difference between first... I'm confused. And it gets even worse when using 2d arrays. Thank you for your help!
#include <iostream>
using namespace std;
int main(void)
{
int v[5] = { 1, 2, 3, 4, 5 };
int *ptr = v;
int *ptr2 = &v[0];
cout << sizeof(v) << endl << sizeof(&v[0]) << endl;
cout << v << endl << &v << endl << &v[0];
system("pause");
return 0;
}