Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 10

Array

(problem solving of ‘c’)

Submitted by : BRANCH: ELECTRICAL ENGINEERING


AKASH RAV ROLL NO .......05
Introduction of array

Arrays is the collection of similar type of data item ; which is stored


in contagious ( a[0], a[1] ) memory allocation Array of characters is
called strings. Each data item in an array is called element and
each element is unique and located in separate memory
allocation.
Types of array :
1. Single dimensional array
2. Two dimensional array
3. Multi dimensional array
 Advantages

Array variable can store more than one value at a time where other
variables can store one value at a time.
Int a=10
 Declaration of an array

 The declaration of an array tells the compiler that the data type the
name of a array and size of a array; For each element which occupy
memory stage.
 After declaring the elements of an array the subscript ( a{[0]…. ) always
starts from 0, which is known as lower bound and upper value is known as
upper bound and last subscript value is one less than the size of array.
Syntax of the array
Int a=[20],i;
For(i=0;i<20;i++)
{
Scanf(“%d”,&a);
}
*/First for loop is used to declare the value of array .*/
For(i=0;i<20;i++);
{
Printf(“%d”,&a[i]);
}
*/Second for is used to operate the value of array*/
Types of array

 Types of array
 1. one dimensional array
 2.two dimensional array
 3. multidimensional array
One dimensional array

 In this array only either rows or column is used.


 Declaration a=[10];
Two dimensional array

 In that type of array rows and column both is declared.


 Declartion of two dimensional array.
 Int a[20][30];
Program on array
 #include<stdio.h>
 #include<conio.h>
 Void main()
 {
 Int a=10,i;
 Printf(“enter the element of array”)
 {
 For(i=0;i<10:i++)
 {
 Scanf(“%d”,&a[i]);
 }
 For(i=0;i<10;i++)
 {
 If(a[i]%2==0)
 Printf(“it is an even number ”);
 Else
 {
 Printf(“it is an odd number”);
 }
 Getch();
THE END

Thank you

Submitted to:-
Assistance Professor (Ashwani )

You might also like