What are the differences between the following notations?
The first allocates a dynamic array and gives you a pointer to it. You will need to delete the array (delete [] p) when you no longer need it, otherwise the memory will leak. It's usually best not to use raw pointers to manage dynamic resources, as it's tricky to make sure it's correctly deleted. Prefer RAII classes such as std::vector<int> to manage the resource automatically.
The second declares an array in whatever scope the declaration appears in. If this is inside a function, it has automatic storage duration and will be destroyed automatically when it goes out of scope. If it's outside a function, it has static storage duration and will be destroyed automatically at the end of the program.
How would I programmatically determine the element count of arrayB?
In the C manner:
size_t arrayB_size = sizeof arrayB / sizeof arrayB[0];
or in the C++ manner:
template <typename T, size_t N> size_t array_size(T(&)[N]) {return N;}
size_t arrayB_size = array_size(arrayB);
Note that you can't determine the size of the dynamic array - that information is lost. The first style would give a bogus result (based on the size of a pointer rather than the array), and the second would fail to compile. That's another reason to perfer vector, which knows its size.
int [5] arrayB;is not legal, you meanint arrayB[5];std::vector. In fact, just usestd::vector, regardless. You'll find it much easier.