However, pointers are declared with the * adorning the type and not the identifier:
int * ident;
For pointers, this means that the type-cast associated with the type declaration is symmetric, but the same is not true for arrays:
(int * )something; // looks just like `int * something;`
(int [] )something; // does not look like `int something [];`
Java—perhaps the only syntactical addition Java made that I like—added the ability for the [] to be specified immediately following the type:
int [] something;
Supporting both syntaxes allows people to choose whichever they find to be most expressive and helpful for the circumstance. It also might make hash declarations much clearer (imho):
In C, arrays must be defined like so:
However, pointers are declared with the
*
adorning the type and not the identifier:For pointers, this means that the type-cast associated with the type declaration is symmetric, but the same is not true for arrays:
Java—perhaps the only syntactical addition Java made that I like—added the ability for the
[]
to be specified immediately following the type:Supporting both syntaxes allows people to choose whichever they find to be most expressive and helpful for the circumstance. It also might make hash declarations much clearer (imho):