Struct elements (fields) can only be accessed by their names explicitly indicated in the program source, which means that each time you access a field, the actual field must be selected and hard-coded at compile time. If you wanted to implement the same thing with arrays, this would mean that you would use explicit constant indexes of the compile-time array (as in your example). In this case, the performance of the two will be exactly the same, and the generated code will be exactly the same (excluding the "malicious" compilers from consideration).
However, note that arrays provide you with an additional degree of freedom: if necessary, you can select elements of the array with a runtime index. This is not possible for structures. Only you know if this matters to you.
On the other hand, note also that arrays in C cannot be copied, which means that you will be forced to use memcpy to copy My4x4Matrix based on the array. When using structure-based, normal language-level copying will work. Arrays can work around this problem by wrapping the actual array in the structure.
source share