Content deleted Content added
Line 27:
==Arrays==
Although C supports static arrays, it is not required that array
Multidimensional arrays are commonly used in numerical algorithms (mainly from applied [[linear algebra]]) to store matrices. The structure of the C array is particularly well suited to this particular task, provided one remembers to count indices starting from 0 instead of 1. However, since arrays are passed merely as pointers, the bounds of the array must be known fixed values or else explicitly passed to any subroutine that requires them, and dynamically sized arrays of arrays cannot be accessed using standard matrix notation. (A workaround for this is to allocate the array with an additional "row vector" of pointers to the columns.) These issues are discussed in the book ''[[Numerical Recipes|Numerical Recipes in C]]'', chapter 1.2, page 20''ff'' ([http://www.library.cornell.edu/nr/bookcpdf/c1-2.pdf read online]). That book also suggests a way to use 1-based indexing by offseting the base pointers, but that technique violates the C standard.
|