This article is ment to explain the differences between arrays and pointers in C.
If you started to learn C, you might have stumbled upon people saying that "array is
just a pointer to its first element". As somewhat true, it's a huge simplification.
To understand why is that, we have to understand what arrays and pointers really are.
Every array type is a pair (type, size)
, where type is the type of its elements,
and size is the number of these elements. Thus int foo[100]
and int bar[200]
are names of two different types: foo is of type int[100]
whereas bar is of