I recently came across this unorthodox way to define a int array type:
typedef int(array)[3];
At first I thought it was an array of function pointers but then I realized that the *
and the ()
were missing, so by looking into the code I deduced the type array was a int[3]
type instead. I normally would declare this type as:
typedef int array[3];
Unless I'm mistaken that they are not the same thing, what is the advantage of doing so in the former way other than to make them look similar to a function pointer?
array
) and the aliased type (int[3]
)using array = int[3];
typedef
: stackoverflow.com/questions/45991094