No. Array is not a constant pointer in C. It is dead wrong.
Array decays into pointer to first element in most cases. That doesn't mean it is a pointer.
Constant thing is coming in your mind because array is non-modifiable lvalue. So you can't use it as one where it is being modified.
From §6.3.2.1p3
Except when it is the operand of the sizeof operator, the _Alignof operator, or the unary & operator, or is a string literal used to initialize an array, an expression that has type ''array of type'' is converted to an expression with type ''pointer to type'' that points to the initial element of the array object and is not an lvalue. If the array object has register storage class, the behavior is undefined.
This explains what happened - balance
in that statement is converted into pointer to the first element. The first element is double
and a pointer to it is double*
and that pointer contains address of balance[0]
.
This paragraph also points out why the &array
is char* (*)[]
because array used as operand to &
address of operator is a case where array is not converted to pointer. That is why the first statement is legal. (Note that char *(*ptr)[4]
is a pointer to an array of 4 char*
-s. Here the address of array
is assigned to ptr
).
from §6.3.2.1p1
...A modifiable lvalue is an lvalue that does not have array type, does not have an incomplete type, does not have a const- qualified type, and if it is a structure or union, does not have any member (including, recursively, any member or element of all contained aggregates or unions) with a const- qualified type.
Whatever the source be, maybe it tried to show you this idea that arrays are not modifiable lvalues so statements like balance++
in C is illegal given that balance
is an array name.
Without going awry or confusing the correct way to describe what array would be from standard §6.2.5p20
An array type describes a contiguously allocated nonempty set of objects with a particular member object type, called the element type. The element type shall be complete whenever the array type is specified. Array types are characterized by their element type and by the number of elements in the array. An array type is said to be derived from its element type, and if its element type is T , the array type is sometimes called ''array of T ''. The construction of an array type from an element type is called ''array type derivation''
Also note one thing, when you used char a[]={"aa","bb"};
- this is wrong in the sense that string literals are char arrays which decays into pointer - so it is an array of char*
-s not array of char
.