[ANSYS, Inc. Logo] return to home search
next up previous contents index

A.9 Arrays

Arrays of variables can be defined using the notation name[size], where name is the variable name and size is an integer that defines the number of elements in the array. The index of a C array always begins at $0$.

Arrays of variables can be of different data types as shown below.



Examples


int a[10], b[10][10];
real radii[5];

a[0] = 1;                  /* a 1-Dimensional array of variable a     */
radii[4] = 3.14159265;     /* a 1-Dimensional array of variable radii */
b[10][10] = 4;             /* a 2-Dimensional array of variable b     */


next up previous contents index Previous: A.8 Functions
Up: A. C Programming Basics
Next: A.10 Pointers
Release 12.0 © ANSYS, Inc. 2009-01-14