Вы находитесь на странице: 1из 12

Arrays

Cognifront.com
Objectives

• To Study Linear Data Structure – Array

• To Define an Array

• To Create an Array

• To Study Array Representation

Cognifront.com
Introduction

Ordered List

Cognifront.com
Arrays

• The ordered list in data structure is known as Arrays.

• Hence, array is a collection of similar data elements.

Cognifront.com
How to define an Array?

int account [1000]

Data type of the array Name of the array Size of the array

Cognifront.com
Example

int set [5]

set [0] = 11

set [1] = 12

set [2] = 13

set [3] = 14

Set [4] = 15 Cognifront.com


How to create an Array

void create_array()
{
int i=0, n=11;
int number[5];

for(i=0; i<5; i++)


{
number[i]= n;
n=n+1;
}
}

Cognifront.com
Array Representation

• One dimensional Array

• Two dimensional Array

• Multidimensional Array

Cognifront.com
One Dimensional Array

week [0]

week [1]

week [2]

week [3]

week [4]

week [5]

week [6]
Cognifront.com
Two Dimensional Array

Mathematics Science History

Student 1 34 57 40
Student 2 75 90 80
Student 3 90 85 70

Student 4 56 40 54

marks [0][0] = 34 marks [0][1] = 57 marks [0][2] = 40

marks [1][0] = 75 marks [1][1] = 90 marks [1][2] = 80

marks [2][0] = 90 marks [2][1] = 85 marks [2][2] = 70

marks [3][0] = 56 marks [3][1] = 40 marks [3][2] = 54


Cognifront.com
Multi Dimensional Array

cube [0][0][0] = (0, 0, 10)

cube [0][1][0] = (0, 0, 0)

cube [0][0][1] = (10, 0, 0)

cube [0][1][1] = (10, 0, 10)

cube [1][0][0] = (0, 10, 10)

cube [1][1][0] = (0, 10, 0)

cube [1][0][1] = (10, 10, 0)


Play Array Video from DVD
cube [1][1][1] = (10, 10, 10)
Cognifront.com
Time for Students’ Questions!
Any Question?

Cognifront.com

Вам также может понравиться