C Tutorials
Hassle-free Arrays and StringsC Tutorials - Hassle-free Arrays and Strings
When you learn that, in C, the first element of an array is referenced as x[0], you appreciate C's reputation for being both efficient and hard to read. The natural way to number the first element in a series, of course, is with 1. But, as a replacement for assembler, C was designed to start arrays with 0 to improve performance. (Arrays that use 0 instead of 1 for the first element permit simpler and faster calculation of memory addresses for subscripted references.) The rules for using C arrays are simple, but don't let that lull you into thinking you won't encounter problems.