Sun Studio 12: C User's Guide

F.2.6 Array Storage

Arrays are stored with their elements in a specific storage order. The elements are actually stored in a linear sequence of storage elements.

C arrays are stored in row-major order; the last subscript in a multidimensional array varies the fastest.

String data types are simply arrays of char elements. The maximum number of characters allowed in a string literal or wide string literal (after concatenation) is 4,294,967,295.

See F.1 Storage Allocation for information on the size limit of storage allocated on the stack.

Table F–15 Array Types and Storage

Type  

Maximum Number of Elements for SPARC and x86  

Maximum Number of Elements for SPARC V9  

char

4,294,967,295 

2,305,843,009,213,693,951 

short

2,147,483,647 

1,152,921,504,606,846,975 

int

1,073,741,823 

576,460,752,303,423,487 

long

1,073,741,823 

288,230,376,151,711,743 

float

1,073,741,823 

576,460,752,303,423,487 

double

536,870,911 

288,230,376,151,711,743 

long double

268,435,451 

144,115,188,075,855,871 

long long [Not valid in -Xc mode with -xc99=none.]

536,870,911 

288,230,376,151,711,743 

Static and global arrays can accommodate many more elements.