Anda di halaman 1dari 9

Array in C

language
Array

In C programming, one of the frequently arising problem is to handle similar types of data.
For example:
If the user want to store marks of 100 students. This can be done by creating 100 variable
individually but, this process is rather tedious and impracticable. These type of problem can be
handled in C programming using arrays.
An array is a sequence of data item of homogeneous value(same type).
Array are a way of grouping together similar items.
By using array program will be efficient.
Array always start from zero.
Example for C Arrays:
int a[10]; // integer array
char b[10]; // character array i.e. string
Array elements
Types of array

There are 2 types of C arrays. They are,


One dimensional array
Multi dimensional array
Twodimensional array
Declaration of one-dimensional array

Declaration of one-dimensional array

Here, the name of array isage. The size of array is 5,i.e., there are 5
items(elements) of arrayage. All element in an arrayare of the same type
(int, in this case).
Accessing array elements
Example of array in C programming
Task

Enter 5 roll no and students name via


array? As a data entry?????

Anda mungkin juga menyukai