+ All Categories
Home > Engineering > Array in c

Array in c

Date post: 07-Aug-2015
Category:
Upload: anish-kumar
View: 160 times
Download: 1 times
Share this document with a friend
Popular Tags:
10
ARRAYS IN C (1-Dimensional & 2-Dimensional) By: Anish Kumar 12/CS/60 Haldia Institute Of Technology Introduction 1-D 2-D Applications Operations Limitations Conclusion Bibliography
Transcript

ARRAYS IN C (1-Dimensional & 2-Dimensional)

By:

Anish Kumar12/CS/60Haldia Institute Of Technology

Intr

od

uct

ion

1

-D

2-D

Ap

plic

ati

on

s

Op

era

tion

s

Li

mit

ati

on

s

Con

clu

sion

Bib

liog

rap

hy

Introduction

Array is a derived data type that represents a collection of the similar types of data with continuous memory locations with fixed size sequence.

Roles

Efficient storing of large volume of data

Efficient access and manipulation of data

Helpful in viewing complex problem in simpler way

Single name for multiple data

Structured Data Type

Array

2-D1-D

1-Dimensional Array

Data_type var_name[Expression]

Data Type is the type of elements to be stored in the array

Var_name is the name of the array like any Other variables

Expression specifies the number of elements to be stored In array

Example : int num[10]; char city[9]= “HALDIA”;char city[9]={ ‘H’,’A’,’L’,’D’,’I’,’A’}

Num[0] =data1

Num[1] =data2

Num[2] =data3

Num[3] =data4

Num[4] =data5

Num[5] =data6

Num[6] =data7

Num[7] =data8

Num[8] =data9

Num[9] =data10

2-DIMENSIONAL ARRAY

0 1 2 3 4

0

1

2

3

4

0 1 2 3 4

0

1

2 7

3

4

int matrix[5] [5];

matrix[2] [1] = 7

0 1 2

0 1 2 3

1 4 5 6

2 7 8 9

3 10 11 12

int array [4][5];or

Int [][] array ={ {1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12} };

Applications

Matrix Problem

Solving different algorithms, graph & tree problem

Sparse Matrix

Storing and searching of large amount of data

Stack, Queue

Array of pointers, Dynamic Arrays

OPERATIONS IN ARRAY

INSERTION

DELETION

MERGING TWO ARRAYS

TRAVERSING

SORTING

SEARCHING

Limitations

Wastage of memory space. We cannot change size of array at the run time.

It can store only similar type of data.

Sometimes it is not easy to operate with many index arrays.

Conclusion

Array has added a new flavour to the programming, the efficiency of C language has reached to zenith in terms of efficient storing , accessing and manipulation of data, speed and reliability.

Bibliography

ANSI C by E Balagurusamy

http://www.slideshare.net

Wikipedia


Recommended