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 : Array Declaration.
Teaching Aids : Diagram and animations, PPTs.
CM304.56 1
Objective
On completion of this period you would be
able to know
Array declaration
One-dimensional array.
CM304.56 2
Types of Arrays
One-dimensional array.
Two dimensional array.
Three dimensional array.
CM304.56 3
Declaration of Array
datatype array_name[size];
datatype is the type of element will be contained in
array. such as int, float, char.
array_name is name of the variable .
size is the maximum number of elements stored in
array.
CM304.56 4
One-dimensional array
Definition:
Whose elements are specified by one subscript
that array is called One-dimensional array.
General form of one-dimensional array:
datatype variable_name [size];
CM304.56 5
Simple program using one-dimensional array
#include<stdio.h> Data type
Variable name
main( )
{
int marks[5]; Array size
int i;
printf (“enter the marks”);
for(i =0;i<5;i++)
{
scanf (“%d”, &marks[ i ]);
printf (“the entered marks is %d \n”, marks[ i ] );
}
} CM304.56 6
Summary
Different types of arrays, like one
dimensional array.
Declaration of one dimensional array with
general form and with examples.
CM304.56 7
Quiz
1.Types of arrays….?
a) one dimensional
b) two dimensional
c) three dimensional
d) all of the above.
CM304.56 8
Quiz
1.Types of arrays….?
a) one dimensional
b) two dimensional
c) three dimensional
d) all of the above.
CM304.56 9
Quiz
2. Which array declaration is correct?
a) data type array_name [size];
b) data type variable name [size] [size];
c) data type variable name;
CM304.56 10
Quiz
2. Which array declaration is correct?
a) data type array_name [size];
b) data type variable name [size] [size];
c) data type variable name;
CM304.56 11
Quiz
3.What is one dimensional array?
a) elements have one subscript.
b) elements have two subscripts.
c) elements have three subscripts.
CM304.56 12
Quiz
3.What is one dimensional array?
a) elements have one subscript.
b) elements have two subscripts.
c) elements have three subscripts.
CM304.56 13
Frequently Asked Questions
1. Define one-dimensional array and represent
the same with the help of schematic diagram.
CM304.56 14