The compiler has complete information about an array (including its size, the number of elements and the size of each element) in exactly the same way it has complete information about a given struct. It obviously can exactly "tell the difference between
int a[10]
and int b[20]
", Georg provided proof for that. (The array information is, of course, frequently lost when arrays are passed to functions which "adjusts" the type to a pointer. But that's a different matter and is a bit comparable to passing a pointer to a struct that has only been forward-declared.)