Você está na página 1de 16

DEPARTMENT OF TECHNICAL EDUCATION

ANDHRA PRADESH
Name of the faculty : K.Jeevan Kumar
Designation : Lecturer.
Branch : Computer Engineering
Institute : V.K.R & V.N.B Polytechnic Gudivada
Year/Semester : III Semester
Subject : UNIX & C
Subject Code : CM-304
Topic : Understand basics of Arrays.
Duration : 50 Min
Sub Topic : Introduction to Arrays and definition.
Teaching Aids : Diagram and animations,ppt.
CM304.55 1
Objective

On completion of this period you would be


able to know

 Array concept.

CM304.55 2
Arrays
What is an array?
The variables are created with primary data types like int,
float, char.

Each variable is given a unique name and can store


one item (or) element under that name.

CM304.55 3
Arrays Contd..

For example :
int a; In variable a you can only enter one value

 The variable a can store only integer value .

 This process is easy to store one or two values but difficult


for more .

CM304.55 4
Arrays Contd..

 Some times you want several same elements


(or) items to be grouped under same variable name.
 That situation is possible in arrays.

For example :
We want 6 elements in variable a that is

0 1 2 3 4 5
a

the 6 elements are under the common name ‘a ’

CM304.55 5
Array definition

 Array is a collection of data elements of the same type.


 They are referred by a common name.
Array
identit
Array
y
name
sub[0] sub[1] sub[2] sub[3] sub[4]
sub[5]
sub
array
Element Elemen Elemen Element Element 5Element 6
1 t2 t3 4
Array
element
s
CM304.55 6
Summary

In this class you have learnt about,


• Introduction to arrays.
• How to store the values in the normal
variable and array variable.
• Definition of array.

CM304.55 7
Quiz

1.Array is used to…?


a) To store similar type of data elements.
b) to store dissimilar type of data elements.
c) to store limited number of elements.

CM304.55 8
Quiz

1.Array is used to…?


a) To store similar type of data elements.
b) to store dissimilar type of data elements.
c) to store limited number of elements.

CM304.55 9
Quiz

2. int a; in the declaration part how many values


are stored?
a) no values.
b) two values.
c) only one value.

CM304.55 10
Quiz

2. int a; in the declaration part how many values


are stored?
a) no values.
b) two values.
c) only one value.

CM304.55 11
Quiz

3. int a[5]; in the declaration part how many values


are stored?
a) one value.
b) five values.
c) four values.

CM304.55 12
Quiz

3. int a[5]; in the declaration part how many values


are stored?
a) one value.
b) five values.
c) four values.

CM304.55 13
Quiz

4. The subscript must be specified with in


the_____?
a) Square brackets [].
b) Parenthesis ().
c) Braces {}.

CM304.55 14
Quiz

4. The subscript must be specified with in


the_____?
a) Square brackets [].
b) Parenthesis ().
c) Braces {}.

CM304.55 15
Frequently Asked Questions

1. Define array and represent the same with the


help of schematic diagram.

CM304.55 16

Você também pode gostar