Possible Duplicate:
How to find the sizeof(a pointer pointing to an array)
I declared a dynamic array like this:
int *arr = new int[n]; //n is entered by user Then used this to find length of array:
int len = sizeof(arr)/sizeof(int); It gives len as 1 instead of n . Why is it so?
int *arr = new int[n];is declaring a pointer.std::vector<int> arr;is declaring a dynamic array.