C_ARRAYS
Vectors, Matrices, Tensors in C


C_ARRAYS is a directory of C programs which illustrate the use of vectors, matrices and tensors.

Licensing:

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

Languages:

C_ARRAYS is available in a C version and a C++ version.

Related Data and Programs:

C, C programs which illustrate some of the features of the C programming language.

CPP_ARRAYS, C++ programs which illustrate the use of vectors, matrices and tensors.

Reference:

  1. Samuel Harbison, Guy Steele,
    C: A Reference Manual,
    Third Edition,
    Prentice Hall, 1991,
    ISBN: 0-13-110933-2,
    LC: QA76.73.C15H38.
  2. Brian Kernighan, Dennis Ritchie,
    The C Programming Language,
    Second Edition,
    Prentice Hall, 1988,
    ISBN: 0-13-110362-8.
  3. Robert Sedgewick,
    Algorithms in C,
    Addison-Wesley, 1990,
    LC: QA76.73.C15S43,
    ISBN: 0-201-51425-7.

Examples and Tests:

ARRAYS is a very simple example of how to set up arrays in C. In particular, we note that vectors are easy to declare with fixed or dynamic dimensions, but that arrays of dimension 2 or greater aren't easy to declare dynamically. The example shows how to work around by settting up a two dimensional array as a one dimensional vector.

POINTERS shows how a two-dimensional array can be defined, either as row or column major, using pointers. Unfortunately, the column major format means that the double indexing lists the column index first!

You can go up one level to the C source codes.


Last revised on 07 October 2012.