I am reading C++ primer book and completely don\'t understand one line:
using int_array = int[4];
typedef int int_array[4]; // This line
for (int_array *
The lines
using int_array = int[4];
and
typedef int int_array[4];
do the same thing. See reference for using and typedef. You can leave one or the other out and the behaviour is the same. It is not an error to have two different declarations, as they are not conflicting (they do the exact same thing).
The first way of doing it (using the using
keyword) was introduced with C++11 and is in my opinion easier to read, so I prefer it over the typedef version.