answersLogoWhite

0


Best Answer

The standard does not specify a limit, it is implementation defined. The practical limit on my system is 30 dimensions. You can easily determine the upper limit by instantiating a static array of char (the smallest data type), where each dimension is 2 (the minimum size for any dimension).

static char ch[2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2] = {0}; // ok

static char no[2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2] = {0}; // no can do!

Note that if you allocate on the stack (non-static allocation), the limit drops to just 19 dimensions.

Note also that a dimension of size 1 isn't an array. You can easily have hundreds of dimensions all of size 1 in an array, but there would only ever be 1 element in the entire array. Thus any dimension of 1 in any array (no matter which dimension) becomes redundant in terms of the array's size. For example, the following definitions are all exactly the same size:

char ch[3][2][1] = {0};

char ch[3][1][2] = {0};

char ch[1][3][2] = {0};

char ch[3][2] = {0};

User Avatar

Wiki User

9y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How many subscript or dimension of array are supported by c program?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Write a program to substrate two matrixs in two dimension array?

You need to specify the language in which you want the subtraction of the two matrix in two dimension array written.


What is the lowest subscript of an array in c plus plus?

The lowest subscript of an array in C, or C++ is 0.


If structure is arraythen an individual array element can be accessed by writing a variable?

A structure is not an array. Individual array elements are accessed through a number, called a "subscript". This subscript can be a constant, or a variable, or any expression that can be evaluated to give an integer.A structure is not an array. Individual array elements are accessed through a number, called a "subscript". This subscript can be a constant, or a variable, or any expression that can be evaluated to give an integer.A structure is not an array. Individual array elements are accessed through a number, called a "subscript". This subscript can be a constant, or a variable, or any expression that can be evaluated to give an integer.A structure is not an array. Individual array elements are accessed through a number, called a "subscript". This subscript can be a constant, or a variable, or any expression that can be evaluated to give an integer.


Why should indexes be used instead of subscripts to identify array elements?

You cannot uses indices instead of subscripts. The subscript operator [] requires an index in order to determine the subscript. Even if you don't use the subscript operator you still need an index to determine the offset of the subscript. Indeed, the only time you do not need an index is when traversing the array using a roving pointer, which is arguably more efficient than using a subscript to traverse an array since subscripts use multiplication instead of the much simpler increment/decrement operation.


True or false when accessing an element of an array such as numbers are the square braces called a subscript?

False. The square braces are the subscript operator. The subscript is the operand, the zero-based offset index that is passed to the operator.

Related questions

What does it mean for a subscript to be out-of -bounds?

This is a type of error that usually occurs in computer programs. An array is defined in which the elements of the array are identified by one or more subscripts. Suppose you have an array which is declared to be of dimension 23. Then if the program tries to access element 26 in that array, it cannot because there is no element of the array in that position. That is when you will get this error message.


Write a program to substrate two matrixs in two dimension array?

You need to specify the language in which you want the subtraction of the two matrix in two dimension array written.


What is the lowest subscript of an array in c plus plus?

The lowest subscript of an array in C, or C++ is 0.


If structure is arraythen an individual array element can be accessed by writing a variable?

A structure is not an array. Individual array elements are accessed through a number, called a "subscript". This subscript can be a constant, or a variable, or any expression that can be evaluated to give an integer.A structure is not an array. Individual array elements are accessed through a number, called a "subscript". This subscript can be a constant, or a variable, or any expression that can be evaluated to give an integer.A structure is not an array. Individual array elements are accessed through a number, called a "subscript". This subscript can be a constant, or a variable, or any expression that can be evaluated to give an integer.A structure is not an array. Individual array elements are accessed through a number, called a "subscript". This subscript can be a constant, or a variable, or any expression that can be evaluated to give an integer.


What is the array of string in c?

A string in C is stored in a 1 dimension array so an array of strings is simply a two dimension array.


What are the kinds of arrays?

1. One dimension array 2. Two dimension array 3. Multi dimentional array


What is the relationship between the value of the subscript and the value of the array element in c?

You can access the array-element via index (or subscript), but it is not possible the other way around.


What happens if a subscript value is negative or higher than the number of elements in an array?

It cannot be part of the array.


Every element in an array is assigned an unique number known as?

subscript


Why should indexes be used instead of subscripts to identify array elements?

You cannot uses indices instead of subscripts. The subscript operator [] requires an index in order to determine the subscript. Even if you don't use the subscript operator you still need an index to determine the offset of the subscript. Indeed, the only time you do not need an index is when traversing the array using a roving pointer, which is arguably more efficient than using a subscript to traverse an array since subscripts use multiplication instead of the much simpler increment/decrement operation.


What is single dimentional?

A single dimension array is an array with one dimension. It is a collection in memory of one or more elements of the same type. int array[100]; declares an array of int's of size 100 elements. The elements are referenced as array[0], the first one, through array[99], the last one.


True or false when accessing an element of an array such as numbers are the square braces called a subscript?

False. The square braces are the subscript operator. The subscript is the operand, the zero-based offset index that is passed to the operator.