SlideShare a Scribd company logo
To presentation
.BCA II SEM.
SUBMITTED TO:
CHETAN SIR
SUBMITTED BY :
HINA KHAN
Prakash Khaire
The Mandvi Education Society Institute of Computer Science
A
R
R
A
Y
S
CONTENTS
 Introduction
 Need for on array
 Types of array
• 1D
• 2D
• MD
 Difference between 1D & 2D Array
 Array Applications
 Advantages & disadvantages
What is an Array ?
• It is derived data type.
• The nature of array is static (fix).
• Array is a collection of similar or
homogeneous data type.
• Array is also known subscript variable
or index variable.
• The lower bond of an array is zero 0.
• The upper bond of an array is n-1.
for ex.-int a[9] is an array that stores 9 integers
• Array index start with zero(0).
• Array end with n-1.
0 1 2 3 4 5 6 7 8
100 102 104 106 108 110 112 114 116
index
elements
Memory address
'
Need for an Array
NEED FOR AN ARRAY
• To store large number of variables of same type under a
single variable.
• E.g.
To store Marks of 50 students.
Record of sales of 100 salesman.
Types of Array
A list of items can be given one variable name using
only one subscript and such a variable is called a one-
dimensional Array.
•Syntax
data_type ArrayName[size];
data_type : is a valid data type like int, float,char
Arrayname : is a valid identifier
size : maximum number of elements that can
be stored in array
1. Declaration of on Array
To declare an array to syntax is-
Data_ type variablename [size];
o The type of data which you
want to store like – int , float
, char.
o Means the name
of an Array.
o The number of Array
type variable.
Ex.- int a [3];
• Type of array variable is “integer”.
• Its variable name is a.
• 3 is the size of the array.
2. Initialization
• An elements of an array must be initialized, otherwise they
may contain “garbage” value.
• An array can be initialized at either of the following stages
o At compile time
o At run time
• At the time of declaration and
initialization at the same time.
• For ex.- int a[5]={1,2,3,4,5}
An array can be explicitly in
initialization at run time.
• To initialize multiple array variable for loop is used.
for ex.-
for (i=0;i<5;i++)
{
scanf (“%d”,&a[i]);
}
3.Assessing
• To print the element of an array is known as
assessing.
• To assessing the element of an array for loop is
used frequently.
for ex.-
for (i=0; i<5 ;i++)
{
printf (“%d”,a[i]);
} OUTPUT:
0
1
2
3
4
Examples:-
1) Enter a one-d array
#include<stdio.h>
int main()
{
int a[10],i;
printf(“enter the array=“);
for(i=0;i<10;i++)
{
scanf(“%d”,&a[i]);
}
printf(“the entered array is=“);
for(i=0;i<10;i++)
{
printf(“%d”,a[i]);
}
return(0);
}
output:
0
1
2
3
4
5
6
7
8
9
• C allows us to define such tables of items by using
two-dimensional arrays.
•The two dimensional array are declared as follows-
type array_name[row_size][column_size];
For ex.- int a [3][2];
Data type
Array name Row=3
Column=2
1. Declaration 2D ARRAY
• To declare an array to syntax is.
• The syntax of 2D array is
datatype arrayname[row] [column];
2.Initializing 2D ARRAY
• Like 1D array ,2D array initialized.
• Tow for loop is used .
ex.-
for (i=0 ;i<3; i++)
{
for (j=0;j<3;j++)
{
scanf(“%d”,&a[i][j]);
}
}
3.Assessing 2D ARRAY
• For loop is used.
Ex.-
for (i=0; i<3; i++)
{
for(j=0; j<3;j++)
{
printf(“t%d”,a[i][j]);
}
print(“n”);
}
• To print the element of an array
is known as assessing.
/* addition of two matrix/*
#include<stdio.h>
int main()
{
int i,j;
int a[3][3],b[3][3],c[3][3];
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf(“enter the matrix a=”);
scanf(“%d”,&a[i][j]);
}
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf(“enter the matrix b=”);
scanf(“%d”,&b[i][j]);
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
c[i][j]=a[i][j]+b[i][j];
}
}
Printf(“/n addition of two matrix=“);
{
for(i=0;i<3;i++)
{
for(J=0;j<3;j++)
{
printf(“%d”,c[i][j]);
}
printf(“/n”);
}
}
return(0);
}
output:
A= B=
C=
9 8 7
6 5 4
3 2 1
1 2 3
4 5 6
7 8 9
10 10 10
10 10 10
10 10 10
/*subtraction of two matrix/*
#include<stdio.h>
int main()
{
int i,j;
int a[3][3],b[3][3],c[3][3];
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf(“enter the matrix a=”);
scanf(“%d”,&a[i][j]);
}
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf(“enter the matrix b=”);
scanf(“%d”,&b[i][j]);
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
c[i][j]=a[i][j]-b[i][j];
}
}
Printf(“/n substract of two matrix=”);
{
for(i=0;i<3;i++)
{
for(J=0;j<3;j++)
{
printf(“%d”,c[i][j]);
}
printf(“/n”);
}
}
return(0);
}
output:
A= B=
C=
2 3 4
5 6 7
8 9 10
1 2 3
4 5 6
7 8 9
1 1 1
1 1 1
1 1 1
/*multiplication of two matrix/*
#include<stdio.h>
int main()
{
int i,j,k;
int a[3][3],b[3][3],c[3][3];
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf(“enter the matrix a=”);
scanf(“%d”,&a[i][j]);
}
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf(“enter the matrix b=”);
scanf(“%d”,&b[i][j]);
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
c[i][j]=0;
for(k=0;k<3;k++)
{
c[i][j]=c[i][j]+a[i][k]*b[k][j];
}
}
}
printf(“n enter the matix a is =”);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf(“t%d”,c[i][j]);
}
printf(“n”);
}
printf(“n enter the matrix b is =”);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf(“t%d”,b[i][j]);
}
printf(“n”);
}
printf(“n the multiplication is =”);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf(“t%d”,c[i][j]);
}
printf(“n”);
}
return(0);
}
output:
A=
B=
AB=
1 2 3
4 5 6
7 8 9
9 8 7
6 5 4
3 2 1
46 28 10
118 73 28
190 118 46
Not in courseNot in
course
• C allows arrays of three or more dimensions. The exact limit
is determined by the compiler
•Syntax-
Datatype aray_name[s1][s2][s3]………….[Sm];
• For ex-
int MyArray[2][3][4];
DIFFERENCE
1D
1. 1D Array contains
single row and
multiple columns.
2. 1D Array is a
simple collection
of elements.
3. Ex:-
2d
1. 2D Array contains
multiple row and
multiple columns.
2. 2D Array is a
collection of 1D
Array .
3. Ex:-
1 2 3 4 1 2 3 4
A 1 2 3
B 4 5 6
C 7 8 9
Array Applications
Array Applications
• Array can be used for sorting elements.
• Array can perform matrix operation.
• Array can be used to sum all the
elements.
• Array can be stores elements of same
data type.
• Given a list of test scores, determine the maximum
and minimum scores.
• Read in a list of student names and rearrange
them in alphabetical order (sorting).
• Given the height measurements of students in a
class, output the names of those students who are
taller than average.
Advantages
&
Disadvantages
Advantages
 It is used to represent multiple data of same type by assigning only
single name.
 It can be used to implement other data structures like –
linked lists , stacks ,queue etc….
 2D array are used to represent matrices.
Disadvantages
 We must know array is static structure It means that array is fixed size. The
memory which is allocated to array can not be increased or reduced.
 Since array is of fixed size , if we allocate more memory than requirement then the
memory space will be wasted . And if we allocate less memory than requirement
than it will create problem.
 The elements of array are stored in consecutive memory location. So insertions
and deletion are very difficult and time consuming.
 Programming in ANSI
(E balagurusamy)
 Thank you Chetan Sir for giving me this topic
I would like to thank my friends who
helped meEkta, Sakina, Kunal
Array 2 hina
Array 2 hina

More Related Content

What's hot

Presentation on array
Presentation on array Presentation on array
Presentation on array
topu93
 
Lecture 2a arrays
Lecture 2a arraysLecture 2a arrays
Lecture 2a arrays
Victor Palmar
 
C++ arrays part1
C++ arrays part1C++ arrays part1
C++ arrays part1
Subhasis Nayak
 
String
StringString
Arrays
ArraysArrays
arrays in c
arrays in carrays in c
arrays in c
vidhi mehta
 
Array
ArrayArray
Array in Java
Array in JavaArray in Java
Array in Java
Ali shah
 
ARRAY
ARRAYARRAY
ARRAY
ayush raj
 
Arrays in c language
Arrays in c languageArrays in c language
Arrays in c language
tanmaymodi4
 
Arrays
ArraysArrays
Arrays
sana younas
 
Java arrays
Java arraysJava arrays
Java arrays
Jin Castor
 
Arrays In C++
Arrays In C++Arrays In C++
Arrays In C++
Awais Alam
 
Array
ArrayArray
Array
PRN USM
 
OOPs with java
OOPs with javaOOPs with java
OOPs with java
AAKANKSHA JAIN
 
C++ Arrays
C++ ArraysC++ Arrays
C++ Arrays
أحمد محمد
 
arrays of structures
arrays of structuresarrays of structures
arrays of structures
arushi bhatnagar
 
Arrays In C
Arrays In CArrays In C
Arrays In C
yndaravind
 
Lecture 3 data structures and algorithms
Lecture 3 data structures and algorithmsLecture 3 data structures and algorithms
Lecture 3 data structures and algorithms
Aakash deep Singhal
 
Data structures
Data structuresData structures
Data structures
Pranav Gupta
 

What's hot (20)

Presentation on array
Presentation on array Presentation on array
Presentation on array
 
Lecture 2a arrays
Lecture 2a arraysLecture 2a arrays
Lecture 2a arrays
 
C++ arrays part1
C++ arrays part1C++ arrays part1
C++ arrays part1
 
String
StringString
String
 
Arrays
ArraysArrays
Arrays
 
arrays in c
arrays in carrays in c
arrays in c
 
Array
ArrayArray
Array
 
Array in Java
Array in JavaArray in Java
Array in Java
 
ARRAY
ARRAYARRAY
ARRAY
 
Arrays in c language
Arrays in c languageArrays in c language
Arrays in c language
 
Arrays
ArraysArrays
Arrays
 
Java arrays
Java arraysJava arrays
Java arrays
 
Arrays In C++
Arrays In C++Arrays In C++
Arrays In C++
 
Array
ArrayArray
Array
 
OOPs with java
OOPs with javaOOPs with java
OOPs with java
 
C++ Arrays
C++ ArraysC++ Arrays
C++ Arrays
 
arrays of structures
arrays of structuresarrays of structures
arrays of structures
 
Arrays In C
Arrays In CArrays In C
Arrays In C
 
Lecture 3 data structures and algorithms
Lecture 3 data structures and algorithmsLecture 3 data structures and algorithms
Lecture 3 data structures and algorithms
 
Data structures
Data structuresData structures
Data structures
 

Similar to Array 2 hina

Array
ArrayArray
Mesics lecture 8 arrays in 'c'
Mesics lecture 8   arrays in 'c'Mesics lecture 8   arrays in 'c'
Mesics lecture 8 arrays in 'c'
eShikshak
 
data structure unit -1_170434dd7400.pptx
data structure unit -1_170434dd7400.pptxdata structure unit -1_170434dd7400.pptx
data structure unit -1_170434dd7400.pptx
coc7987515756
 
ARRAYS.pptx
ARRAYS.pptxARRAYS.pptx
ARRAYS.pptx
MamataAnilgod
 
2 Arrays & Strings.pptx
2 Arrays & Strings.pptx2 Arrays & Strings.pptx
2 Arrays & Strings.pptx
aarockiaabinsAPIICSE
 
Arrays
ArraysArrays
UNIT-5_Array in c_part1.pptx
UNIT-5_Array in c_part1.pptxUNIT-5_Array in c_part1.pptx
UNIT-5_Array in c_part1.pptx
sangeeta borde
 
arrays.docx
arrays.docxarrays.docx
Unit 2 linear data structures
Unit 2   linear data structuresUnit 2   linear data structures
Unit 2 linear data structures
Senthil Murugan
 
Arrays and Strings
Arrays and Strings Arrays and Strings
Arrays and Strings
Dr.Subha Krishna
 
Arrays
ArraysArrays
Arrays
swathi reddy
 
Array
ArrayArray
Arrays
ArraysArrays
Programming in c Arrays
Programming in c ArraysProgramming in c Arrays
Programming in c Arrays
janani thirupathi
 
Arrays
ArraysArrays
Arrays 1D and 2D , and multi dimensional
Arrays 1D and 2D , and multi dimensional Arrays 1D and 2D , and multi dimensional
Arrays 1D and 2D , and multi dimensional
Appili Vamsi Krishna
 
Introduction to Array & Structure & Basic Algorithms.pptx
Introduction to Array & Structure & Basic Algorithms.pptxIntroduction to Array & Structure & Basic Algorithms.pptx
Introduction to Array & Structure & Basic Algorithms.pptx
MrNikhilMohanShinde
 
Array
ArrayArray
unit 2.pptx
unit 2.pptxunit 2.pptx
unit 2.pptx
researchgrad82
 
Chapter-Five.pptx
Chapter-Five.pptxChapter-Five.pptx
Chapter-Five.pptx
berekethailu2
 

Similar to Array 2 hina (20)

Array
ArrayArray
Array
 
Mesics lecture 8 arrays in 'c'
Mesics lecture 8   arrays in 'c'Mesics lecture 8   arrays in 'c'
Mesics lecture 8 arrays in 'c'
 
data structure unit -1_170434dd7400.pptx
data structure unit -1_170434dd7400.pptxdata structure unit -1_170434dd7400.pptx
data structure unit -1_170434dd7400.pptx
 
ARRAYS.pptx
ARRAYS.pptxARRAYS.pptx
ARRAYS.pptx
 
2 Arrays & Strings.pptx
2 Arrays & Strings.pptx2 Arrays & Strings.pptx
2 Arrays & Strings.pptx
 
Arrays
ArraysArrays
Arrays
 
UNIT-5_Array in c_part1.pptx
UNIT-5_Array in c_part1.pptxUNIT-5_Array in c_part1.pptx
UNIT-5_Array in c_part1.pptx
 
arrays.docx
arrays.docxarrays.docx
arrays.docx
 
Unit 2 linear data structures
Unit 2   linear data structuresUnit 2   linear data structures
Unit 2 linear data structures
 
Arrays and Strings
Arrays and Strings Arrays and Strings
Arrays and Strings
 
Arrays
ArraysArrays
Arrays
 
Array
ArrayArray
Array
 
Arrays
ArraysArrays
Arrays
 
Programming in c Arrays
Programming in c ArraysProgramming in c Arrays
Programming in c Arrays
 
Arrays
ArraysArrays
Arrays
 
Arrays 1D and 2D , and multi dimensional
Arrays 1D and 2D , and multi dimensional Arrays 1D and 2D , and multi dimensional
Arrays 1D and 2D , and multi dimensional
 
Introduction to Array & Structure & Basic Algorithms.pptx
Introduction to Array & Structure & Basic Algorithms.pptxIntroduction to Array & Structure & Basic Algorithms.pptx
Introduction to Array & Structure & Basic Algorithms.pptx
 
Array
ArrayArray
Array
 
unit 2.pptx
unit 2.pptxunit 2.pptx
unit 2.pptx
 
Chapter-Five.pptx
Chapter-Five.pptxChapter-Five.pptx
Chapter-Five.pptx
 

Recently uploaded

官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样
官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样
官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样
2zjra9bn
 
Learnings from Successful Jobs Searchers
Learnings from Successful Jobs SearchersLearnings from Successful Jobs Searchers
Learnings from Successful Jobs Searchers
Bruce Bennett
 
lab.123456789123456789123456789123456789
lab.123456789123456789123456789123456789lab.123456789123456789123456789123456789
lab.123456789123456789123456789123456789
Ghh
 
Leave-rules.ppt CCS leave rules 1972 for central govt employees
Leave-rules.ppt CCS leave rules 1972 for central govt employeesLeave-rules.ppt CCS leave rules 1972 for central govt employees
Leave-rules.ppt CCS leave rules 1972 for central govt employees
Sreenivas702647
 
Leadership Ambassador club Adventist module
Leadership Ambassador club Adventist moduleLeadership Ambassador club Adventist module
Leadership Ambassador club Adventist module
kakomaeric00
 
IT Career Hacks Navigate the Tech Jungle with a Roadmap
IT Career Hacks Navigate the Tech Jungle with a RoadmapIT Career Hacks Navigate the Tech Jungle with a Roadmap
IT Career Hacks Navigate the Tech Jungle with a Roadmap
Base Camp
 
0624.speakingengagementsandteaching-01.pdf
0624.speakingengagementsandteaching-01.pdf0624.speakingengagementsandteaching-01.pdf
0624.speakingengagementsandteaching-01.pdf
Thomas GIRARD BDes
 
Introducing Gopay Mobile App For Environment.pptx
Introducing Gopay Mobile App For Environment.pptxIntroducing Gopay Mobile App For Environment.pptx
Introducing Gopay Mobile App For Environment.pptx
FauzanHarits1
 
Jill Pizzola's Tenure as Senior Talent Acquisition Partner at THOMSON REUTERS...
Jill Pizzola's Tenure as Senior Talent Acquisition Partner at THOMSON REUTERS...Jill Pizzola's Tenure as Senior Talent Acquisition Partner at THOMSON REUTERS...
Jill Pizzola's Tenure as Senior Talent Acquisition Partner at THOMSON REUTERS...
dsnow9802
 
Job Finding Apps Everything You Need to Know in 2024
Job Finding Apps Everything You Need to Know in 2024Job Finding Apps Everything You Need to Know in 2024
Job Finding Apps Everything You Need to Know in 2024
SnapJob
 
5 Common Mistakes to Avoid During the Job Application Process.pdf
5 Common Mistakes to Avoid During the Job Application Process.pdf5 Common Mistakes to Avoid During the Job Application Process.pdf
5 Common Mistakes to Avoid During the Job Application Process.pdf
Alliance Jobs
 
Resumes, Cover Letters, and Applying Online
Resumes, Cover Letters, and Applying OnlineResumes, Cover Letters, and Applying Online
Resumes, Cover Letters, and Applying Online
Bruce Bennett
 
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
2zjra9bn
 
Gabrielle M. A. Sinaga Portfolio, Film Student (2024)
Gabrielle M. A. Sinaga Portfolio, Film Student (2024)Gabrielle M. A. Sinaga Portfolio, Film Student (2024)
Gabrielle M. A. Sinaga Portfolio, Film Student (2024)
GabrielleSinaga
 
Status of Women in Pakistan.pptxStatus of Women in Pakistan.pptx
Status of Women in Pakistan.pptxStatus of Women in Pakistan.pptxStatus of Women in Pakistan.pptxStatus of Women in Pakistan.pptx
Status of Women in Pakistan.pptxStatus of Women in Pakistan.pptx
MuhammadWaqasBaloch1
 
labb123456789123456789123456789123456789
labb123456789123456789123456789123456789labb123456789123456789123456789123456789
labb123456789123456789123456789123456789
Ghh
 
A Guide to a Winning Interview June 2024
A Guide to a Winning Interview June 2024A Guide to a Winning Interview June 2024
A Guide to a Winning Interview June 2024
Bruce Bennett
 
How to Prepare for Fortinet FCP_FAC_AD-6.5 Certification?
How to Prepare for Fortinet FCP_FAC_AD-6.5 Certification?How to Prepare for Fortinet FCP_FAC_AD-6.5 Certification?
How to Prepare for Fortinet FCP_FAC_AD-6.5 Certification?
NWEXAM
 
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAANBUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
cahgading001
 
Switching Careers Slides - JoyceMSullivan SocMediaFin - 2024Jun11.pdf
Switching Careers Slides - JoyceMSullivan SocMediaFin -  2024Jun11.pdfSwitching Careers Slides - JoyceMSullivan SocMediaFin -  2024Jun11.pdf
Switching Careers Slides - JoyceMSullivan SocMediaFin - 2024Jun11.pdf
SocMediaFin - Joyce Sullivan
 

Recently uploaded (20)

官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样
官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样
官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样
 
Learnings from Successful Jobs Searchers
Learnings from Successful Jobs SearchersLearnings from Successful Jobs Searchers
Learnings from Successful Jobs Searchers
 
lab.123456789123456789123456789123456789
lab.123456789123456789123456789123456789lab.123456789123456789123456789123456789
lab.123456789123456789123456789123456789
 
Leave-rules.ppt CCS leave rules 1972 for central govt employees
Leave-rules.ppt CCS leave rules 1972 for central govt employeesLeave-rules.ppt CCS leave rules 1972 for central govt employees
Leave-rules.ppt CCS leave rules 1972 for central govt employees
 
Leadership Ambassador club Adventist module
Leadership Ambassador club Adventist moduleLeadership Ambassador club Adventist module
Leadership Ambassador club Adventist module
 
IT Career Hacks Navigate the Tech Jungle with a Roadmap
IT Career Hacks Navigate the Tech Jungle with a RoadmapIT Career Hacks Navigate the Tech Jungle with a Roadmap
IT Career Hacks Navigate the Tech Jungle with a Roadmap
 
0624.speakingengagementsandteaching-01.pdf
0624.speakingengagementsandteaching-01.pdf0624.speakingengagementsandteaching-01.pdf
0624.speakingengagementsandteaching-01.pdf
 
Introducing Gopay Mobile App For Environment.pptx
Introducing Gopay Mobile App For Environment.pptxIntroducing Gopay Mobile App For Environment.pptx
Introducing Gopay Mobile App For Environment.pptx
 
Jill Pizzola's Tenure as Senior Talent Acquisition Partner at THOMSON REUTERS...
Jill Pizzola's Tenure as Senior Talent Acquisition Partner at THOMSON REUTERS...Jill Pizzola's Tenure as Senior Talent Acquisition Partner at THOMSON REUTERS...
Jill Pizzola's Tenure as Senior Talent Acquisition Partner at THOMSON REUTERS...
 
Job Finding Apps Everything You Need to Know in 2024
Job Finding Apps Everything You Need to Know in 2024Job Finding Apps Everything You Need to Know in 2024
Job Finding Apps Everything You Need to Know in 2024
 
5 Common Mistakes to Avoid During the Job Application Process.pdf
5 Common Mistakes to Avoid During the Job Application Process.pdf5 Common Mistakes to Avoid During the Job Application Process.pdf
5 Common Mistakes to Avoid During the Job Application Process.pdf
 
Resumes, Cover Letters, and Applying Online
Resumes, Cover Letters, and Applying OnlineResumes, Cover Letters, and Applying Online
Resumes, Cover Letters, and Applying Online
 
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
 
Gabrielle M. A. Sinaga Portfolio, Film Student (2024)
Gabrielle M. A. Sinaga Portfolio, Film Student (2024)Gabrielle M. A. Sinaga Portfolio, Film Student (2024)
Gabrielle M. A. Sinaga Portfolio, Film Student (2024)
 
Status of Women in Pakistan.pptxStatus of Women in Pakistan.pptx
Status of Women in Pakistan.pptxStatus of Women in Pakistan.pptxStatus of Women in Pakistan.pptxStatus of Women in Pakistan.pptx
Status of Women in Pakistan.pptxStatus of Women in Pakistan.pptx
 
labb123456789123456789123456789123456789
labb123456789123456789123456789123456789labb123456789123456789123456789123456789
labb123456789123456789123456789123456789
 
A Guide to a Winning Interview June 2024
A Guide to a Winning Interview June 2024A Guide to a Winning Interview June 2024
A Guide to a Winning Interview June 2024
 
How to Prepare for Fortinet FCP_FAC_AD-6.5 Certification?
How to Prepare for Fortinet FCP_FAC_AD-6.5 Certification?How to Prepare for Fortinet FCP_FAC_AD-6.5 Certification?
How to Prepare for Fortinet FCP_FAC_AD-6.5 Certification?
 
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAANBUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
 
Switching Careers Slides - JoyceMSullivan SocMediaFin - 2024Jun11.pdf
Switching Careers Slides - JoyceMSullivan SocMediaFin -  2024Jun11.pdfSwitching Careers Slides - JoyceMSullivan SocMediaFin -  2024Jun11.pdf
Switching Careers Slides - JoyceMSullivan SocMediaFin - 2024Jun11.pdf
 

Array 2 hina

  • 2. .BCA II SEM. SUBMITTED TO: CHETAN SIR SUBMITTED BY : HINA KHAN
  • 3. Prakash Khaire The Mandvi Education Society Institute of Computer Science A R R A Y S
  • 4. CONTENTS  Introduction  Need for on array  Types of array • 1D • 2D • MD  Difference between 1D & 2D Array  Array Applications  Advantages & disadvantages
  • 5. What is an Array ?
  • 6. • It is derived data type. • The nature of array is static (fix). • Array is a collection of similar or homogeneous data type. • Array is also known subscript variable or index variable.
  • 7. • The lower bond of an array is zero 0. • The upper bond of an array is n-1. for ex.-int a[9] is an array that stores 9 integers • Array index start with zero(0). • Array end with n-1. 0 1 2 3 4 5 6 7 8 100 102 104 106 108 110 112 114 116 index elements Memory address
  • 9. NEED FOR AN ARRAY • To store large number of variables of same type under a single variable. • E.g. To store Marks of 50 students. Record of sales of 100 salesman.
  • 11.
  • 12. A list of items can be given one variable name using only one subscript and such a variable is called a one- dimensional Array. •Syntax data_type ArrayName[size]; data_type : is a valid data type like int, float,char Arrayname : is a valid identifier size : maximum number of elements that can be stored in array
  • 13. 1. Declaration of on Array To declare an array to syntax is- Data_ type variablename [size]; o The type of data which you want to store like – int , float , char. o Means the name of an Array. o The number of Array type variable. Ex.- int a [3]; • Type of array variable is “integer”. • Its variable name is a. • 3 is the size of the array.
  • 14. 2. Initialization • An elements of an array must be initialized, otherwise they may contain “garbage” value. • An array can be initialized at either of the following stages o At compile time o At run time • At the time of declaration and initialization at the same time. • For ex.- int a[5]={1,2,3,4,5} An array can be explicitly in initialization at run time. • To initialize multiple array variable for loop is used. for ex.- for (i=0;i<5;i++) { scanf (“%d”,&a[i]); }
  • 15. 3.Assessing • To print the element of an array is known as assessing. • To assessing the element of an array for loop is used frequently. for ex.- for (i=0; i<5 ;i++) { printf (“%d”,a[i]); } OUTPUT: 0 1 2 3 4
  • 16. Examples:- 1) Enter a one-d array #include<stdio.h> int main() { int a[10],i; printf(“enter the array=“); for(i=0;i<10;i++) { scanf(“%d”,&a[i]); } printf(“the entered array is=“); for(i=0;i<10;i++) { printf(“%d”,a[i]); } return(0); }
  • 18. • C allows us to define such tables of items by using two-dimensional arrays. •The two dimensional array are declared as follows- type array_name[row_size][column_size]; For ex.- int a [3][2]; Data type Array name Row=3 Column=2
  • 19. 1. Declaration 2D ARRAY • To declare an array to syntax is. • The syntax of 2D array is datatype arrayname[row] [column]; 2.Initializing 2D ARRAY • Like 1D array ,2D array initialized. • Tow for loop is used . ex.- for (i=0 ;i<3; i++) { for (j=0;j<3;j++) { scanf(“%d”,&a[i][j]); } }
  • 20. 3.Assessing 2D ARRAY • For loop is used. Ex.- for (i=0; i<3; i++) { for(j=0; j<3;j++) { printf(“t%d”,a[i][j]); } print(“n”); } • To print the element of an array is known as assessing.
  • 21. /* addition of two matrix/* #include<stdio.h> int main() { int i,j; int a[3][3],b[3][3],c[3][3]; for(i=0;i<3;i++) { for(j=0;j<3;j++) { printf(“enter the matrix a=”); scanf(“%d”,&a[i][j]); } } for(i=0;i<3;i++) { for(j=0;j<3;j++) { printf(“enter the matrix b=”); scanf(“%d”,&b[i][j]); }
  • 22. for(i=0;i<3;i++) { for(j=0;j<3;j++) { c[i][j]=a[i][j]+b[i][j]; } } Printf(“/n addition of two matrix=“); { for(i=0;i<3;i++) { for(J=0;j<3;j++) { printf(“%d”,c[i][j]); } printf(“/n”); } } return(0); }
  • 23. output: A= B= C= 9 8 7 6 5 4 3 2 1 1 2 3 4 5 6 7 8 9 10 10 10 10 10 10 10 10 10
  • 24. /*subtraction of two matrix/* #include<stdio.h> int main() { int i,j; int a[3][3],b[3][3],c[3][3]; for(i=0;i<3;i++) { for(j=0;j<3;j++) { printf(“enter the matrix a=”); scanf(“%d”,&a[i][j]); } } for(i=0;i<3;i++) { for(j=0;j<3;j++) { printf(“enter the matrix b=”); scanf(“%d”,&b[i][j]); }
  • 25. for(i=0;i<3;i++) { for(j=0;j<3;j++) { c[i][j]=a[i][j]-b[i][j]; } } Printf(“/n substract of two matrix=”); { for(i=0;i<3;i++) { for(J=0;j<3;j++) { printf(“%d”,c[i][j]); } printf(“/n”); } } return(0); }
  • 26. output: A= B= C= 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 1 1 1 1 1 1 1 1 1
  • 27. /*multiplication of two matrix/* #include<stdio.h> int main() { int i,j,k; int a[3][3],b[3][3],c[3][3]; for(i=0;i<3;i++) { for(j=0;j<3;j++) { printf(“enter the matrix a=”); scanf(“%d”,&a[i][j]); } } for(i=0;i<3;i++) { for(j=0;j<3;j++) { printf(“enter the matrix b=”); scanf(“%d”,&b[i][j]); }
  • 28. for(i=0;i<3;i++) { for(j=0;j<3;j++) { c[i][j]=0; for(k=0;k<3;k++) { c[i][j]=c[i][j]+a[i][k]*b[k][j]; } } } printf(“n enter the matix a is =”); for(i=0;i<3;i++) { for(j=0;j<3;j++) { printf(“t%d”,c[i][j]); } printf(“n”); }
  • 29. printf(“n enter the matrix b is =”); for(i=0;i<3;i++) { for(j=0;j<3;j++) { printf(“t%d”,b[i][j]); } printf(“n”); } printf(“n the multiplication is =”); for(i=0;i<3;i++) { for(j=0;j<3;j++) { printf(“t%d”,c[i][j]); } printf(“n”); } return(0); }
  • 30. output: A= B= AB= 1 2 3 4 5 6 7 8 9 9 8 7 6 5 4 3 2 1 46 28 10 118 73 28 190 118 46
  • 31. Not in courseNot in course
  • 32. • C allows arrays of three or more dimensions. The exact limit is determined by the compiler •Syntax- Datatype aray_name[s1][s2][s3]………….[Sm]; • For ex- int MyArray[2][3][4];
  • 33.
  • 34. DIFFERENCE 1D 1. 1D Array contains single row and multiple columns. 2. 1D Array is a simple collection of elements. 3. Ex:- 2d 1. 2D Array contains multiple row and multiple columns. 2. 2D Array is a collection of 1D Array . 3. Ex:- 1 2 3 4 1 2 3 4 A 1 2 3 B 4 5 6 C 7 8 9
  • 36. Array Applications • Array can be used for sorting elements. • Array can perform matrix operation. • Array can be used to sum all the elements. • Array can be stores elements of same data type.
  • 37. • Given a list of test scores, determine the maximum and minimum scores. • Read in a list of student names and rearrange them in alphabetical order (sorting). • Given the height measurements of students in a class, output the names of those students who are taller than average.
  • 39. Advantages  It is used to represent multiple data of same type by assigning only single name.  It can be used to implement other data structures like – linked lists , stacks ,queue etc….  2D array are used to represent matrices.
  • 40. Disadvantages  We must know array is static structure It means that array is fixed size. The memory which is allocated to array can not be increased or reduced.  Since array is of fixed size , if we allocate more memory than requirement then the memory space will be wasted . And if we allocate less memory than requirement than it will create problem.  The elements of array are stored in consecutive memory location. So insertions and deletion are very difficult and time consuming.
  • 41.  Programming in ANSI (E balagurusamy)  Thank you Chetan Sir for giving me this topic I would like to thank my friends who helped meEkta, Sakina, Kunal