Only if you input n first, then declare your array later.
In your code, you declare your arr to be n element long. However, at the time of execution at that point, the value of n is undefined. Hence the result is undetermined and your code is wrong.
Would you input the value of n first, the program would have arr initialized to the right size.
Here's an example code below:
#include <iostream>
using namespace std;
int main()
{
size_t size;
cout << "Please, enter the size of the array: ";
cin >> size;
int array[size];
// Have fun using your array
cout << "The actual size of array is: " << (sizeof(array) / sizeof(array[0])) << endl;
return 0;
}