Types of Arrays

Share:

Types of Arrays

Linear Array or One-Dimensional Array:

An array in which each element can be referred by one subscript or index is known as one-dimensional array or linear array.

One-dimensional array is a finite set of homogeneous elements such that each element can be identified respectively by a set of n consecutive numbers 0,1,2,3,…. N-1.

If an array is denoted by the letter A then its elements can be denoted in C as:A[0], A[1], A[2], A[3]….A[n-1] 

Anarray can be declared in C just like any other variable.

The definition consists of type, array name and size.

The array size has to be a positive integer constant.

For Example: int marks[5];

Multi-Dimensional Array:

An array in which each element can be referred by more than one subscripts is known as multi-dimensional array.

The array in which each element can be referred by two subscripts is a two-dimensional array, a three-dimensional array has three subscripts and so on.

In C languages a two-dimensional array called a having m rows and n columns of integer type can be declared as: int a[m][n];

For example: int marks[5][5];

IMPORTANT LINKS HEAR:
Array | Types of Arrays | Passing Array to Functions | Declaration of Array | Initializing ArraysDifference between an Array and an Ordinary Variable
LINKS:
Array | Types of Arrays | Declaration of Array | Initializing ArraysDifference between an Array and an Ordinary Variable | String | Declaring a string | Initializing a string | Different functions used to Input of Strings Data | Different Functions used to Output of strings data | Pointer | There are number of reasons for using pointers | Difference between An Array and Pointer | Storage Class | In C, there are four types of storage classes as below | Algorithm | Characteristics/Qualities of a good Algorithm | Flow Chart
ALL LINKS HEAR:

No comments