Home | » | C Programming | » | C Arrays |
Array is similar type of data collection name i.e. it is a collection of same data type elements. An array is a group of related data items, which share common name. It is the set of homogeneous data.
Program without array having different variables:
Output is as :
20 30 40 50
Program with array having same variable name
Output is as :
How many number you want to enter: 5
Enter the 5 different elements in the array:
Enter the 5 different elements in the array:
20 30 40 50
Different array elements are:
20 30 40 50
Types of Array
Linear Array
This type of array is also called one Dimensional Array. This is also called list array. Another name of linear array is called single-dimensional array. These array are of ladder type. In the linear array only one subscript is used. It is written either in row or in column form.
The syntax to define or declare linear array is:
where data types are integer(int), real(float), double and character(char).
For example, some of the valid one dimensional array declaration statements are written as below:
int a[50];
float f[50];
char n[20];
Output is as :
Non-Linear Array
Array of having different dimensions or n subscript is in the form of Non-linear array. Non-linear array are further of n different types as:
(a) Two Dimensional Array
(b) Three Dimensional Array
............................
(n) N-Dimensional Array
Two-Dimensional Array
These arrays are also called double dimensional array. Another name of two-dimensional array is Tabular or Rectangular Array. These array are in row and column form, so these are also called Row-Column array or square array.
The syntax to define or declare two dimensional array is as:
For example, some of the valid one dimensional array declaration statements are written as below:
int a[10][10];
float f[50][50];
char n[20][20];
Output is as :
6 comments
Click here for commentsnice article.thank you for you post.
Replyvisit
web programming tutorial
welookups
Nice ,visit studycodicodinginc.blogspot.com
Replynice article for beginners.thank you.
Replyjava tutorial
great post it's very helpfully.
ReplyDvivek
Hey nice article about arrays in c programming explanation about array is good. Also read my article about arrays in c programming here.
Replynice article. for more programs in C language, you can check C programs
ReplyConversionConversion EmoticonEmoticon