C programming (Array) computer project Class 10

1156

Array is a collection of  homogenous Data stored under unique name  . The value in an array  is called as element of an array

This element are accessed by a number called as subscript or index number
Array may be any variable type. it is also called as subscripted variable .

Types of an array

There are basically two type of an array:

1.one single dimensional array

2. Two dimensional array

Single dimensional array


The array which is used to represent and store data in a linear form is called as single dimensional array

Syntax:

<data-type> <array-name>[size];

Example

int a [3]

char ch [20] = “introduction”;

float tax[3]={5270.43,78.54,3720};

The total size of array variable occupied in the memory is

Total size=length of array *size of data type

In above example a is an array of type integer which has storage size of 3 element so the total size below is 3*2 =6 byte.

Memory Allocation

Program:

/*Program to demonstrate one dimensional array*/

Features

array size should be positive number only

String array always terminate with null character
Element are counted from 0 to n – 1
Useful for multiple reading of element


Disadvantage:


There is no easy method to initiate large number of array element
It is difficult to insulize selected element

Two –Dimensional Array

Syntax:

<data_type><array_name>[row_subscript][column_subscript];

Example:

In above example is an area of type integer which have a storage size 3*3 matrix.

Memory Allocation :

Program :

Limitation of two-dimensional array :

(a) we cannot delete any element from an array.

(b) if we do not know that how many elements have to be stored in a memory in advance, then there will be memory wastage at large array size is specified.

Conclusion :

This project give the knowledge about array and types of used in C-language.

VIVA-VOCE QUESTIONS

Ques.1 What is an array?

Ans. An are is a collection of variables, which are all the same type.

Ques.2 From which element binary search starts searching in an array?

Ans. Middle element.

Ques.3 What is sorting?

Ans. Arranging the data in some order is known as sorting.

Ques.4 What is the number (index) of first element in array?

Ans. 0 (Zero).

Also Read

Class 10th Computer Science Project Work

Class 10th Computer Science ka Project Work in Hindi

Class 10th Computer Science Project Work-3

Class 10th Computer Science Project – 2

LEAVE A REPLY

Please enter your comment!
Please enter your name here