Let me correct you.
double* foo;
declares a pointer to a double, named foo.
double foo[] = {1.1, 2.2, 3.3};
declares an array of doubles named foo, for which no memory has yet been allocated. Leftover from C++'s C's roots, is the fact that an array can decay to a pointer. So it is possible to do the following:
double foo[] = {1.1, 2.2, 3.3};
double bar* = foo[0]; // bar now points to the first element of foo.
But this is does not mean that foo and bar are the same thing. You can use a pointer to iterate over the contents of a c-array (assuming you know the size), , but there are subtle areas where the difference could trip you up (e.g. below).
You could also do something like:
double *foo;
// call something that allocates memory for an array and assigned the address of the first element to foo.
But in that case you are going to have to keep track of the array size yourself. That's why in C++, if you are using a statically allocated array, you should prefer std::array, and if you are using a dynamically allocated array, you should prefer std::vector, as these classes will handle the details better than you are likely to.
There is a cute way, which I don't recommend you use, but is an illustration of the differnece between double* and double foo[], which Scott Meyers talks about in "Effective Modern C++":
template <typename T, std::size_t N>
constexpr std::size_t arraySize(T (&)[N]) noexcept
{
return N;
}
double foo[] = {1.1, 2.2, 3.3};
constexpr int array_size = arraySize(foo);
Will create a c-array with 3 doubles, and initialize the const_expr (it could be a variable, i used const_expr to make it explicit that this is deduced at compile time) array_size to the size of your array.
But avoid all that if you can and use std::array and std::vector when you can.