SlideShare uma empresa Scribd logo
1 de 24
Baixar para ler offline
2011

Topic: ARRAY by

Atiqa, Rafia ; Rbiya, Rabia

1
 Introduction to the ARRAY
 Classification
 Array Declaration

 Array Initialization
 Array with FOR Loop
 Upper and lower limit of Array
 Advantages
 Disadvantages
 Conclusion
2011

Topic: ARRAY by

Atiqa, Rafia ; Rbiya, Rabia

2
 An Array is a group of memory location s
having same data type
 Data type specify the type of data it stores
 A group of CONTINOUS memory locations

Example: Int A[0][1][2][3][4]
 Store JUST single variable
 C++ store list values in it
 Arrange in Rows/ Columns
2011

Topic: ARRAY by

Atiqa, Rafia ; Rbiya, Rabia

3
To refer a particular location its Name and
its “SUBSCRIPT “is specifies

WHAT IS A „SUBSCRIPT‟?
The number contained within Square bracket
It MUST be an integer or expression
If its an integer expression then it is
evaluated to describe the subscript
EXAMPLE:
c[a+b] +=2; if a=5, and b=6

2011

Topic: ARRAY by

Atiqa, Rafia ; Rbiya, Rabia

4
In some languages (e.g. COBOL) arrays are

called “Tables”.
An individual value in an array is called an
“Element”

2011

Topic: ARRAY by

Atiqa, Rafia ; Rbiya, Rabia

5
There are divided into following types;
1. One Dimensional Arrays:

A[0][1][2][3][4][5][6]………………[n]
2. Two Dimensional Arrays:
A[0][0]

A[0][1]

A[0][2]

A[0][3]

A[0][4]

A[1][0]

A[1][1]

A[1][2]

A[1][3]

A[1][4]

A[2][0]

A[2][1]

A[2][2]

A[2][3]

A[2][4]

3. Multi Dimensional Arrays:

3D, 4D etc
2011

Topic: ARRAY by

Atiqa, Rafia ; Rbiya, Rabia

6
We Explore The Following Things in this Section:
•Arrays Declaration
•Arrays Initialization
•With FOR Loop

2011

Topic: ARRAY by

Atiqa, Rafia ; Rbiya, Rabia

7
As just in few steps…

Lets have an example of OVERS in a cricket
match, its 6 per over
We declared it something like that…
Int balls[5]
Subscript/index
Array_name
OR….
2011

Topic: ARRAY by

Atiqa, Rafia ; Rbiya, Rabia

8
Its still the same!!!

Int balls= {1,2,3,4,5,6}
More Examplex:
Char city= {L,A,H,O,R,E}
FLOAT NUM={1.2, 1.3, 1.4 ,1.5 }

2011

Topic: ARRAY by

Atiqa, Rafia ; Rbiya, Rabia

9
It can be intialized as they declared
Do not need to declared the subscript if initial

values are defined
What's the initial values we are talking about..
Int k[]= {12,13,14,15}

WE HAVENT SEPCIFY THE INDEX-ANOTHER

NAME AND STIL IT WORKS
2011

Topic: ARRAY by

Atiqa, Rafia ; Rbiya, Rabia

10
Because array automatically generate the
space for it

JUST FOR UNDERSTANDING!!!

Int k [5]= {12,13,14,15}
With index it something look like this…..
C++ does not flag out any error if index go
out of the bound…
HOW?????
Char k[7]={A,R,R,A,Y}
Even the memory remains empty still it does
not cerate any error…
2011

Topic: ARRAY by

Atiqa, Rafia ; Rbiya, Rabia

11
Almost always needed to steep through the ARRAY
The loop is used is “FOR-LOOP”
Can not do manipulation easily then
BUT WHY?????

Loops are use to REPEATATION

so as in the case of array we MUXT declared the
index of ≥0 ; for
 C++ to pick up the required index it uses the loop.
But just not used in some fewer cases
2011

Topic: ARRAY by

Atiqa, Rafia ; Rbiya, Rabia

12
2011

Topic: ARRAY by

Atiqa, Rafia ; Rbiya, Rabia

13
• We „r going to explore the following contents in
1.
2.
3.
4.
5.

2011

this:
Introduction to 2D-Array
2D Array with nested FOR loop
Upper and lower limit of array
Advantages
Disadvantages

Topic: ARRAY by

Atiqa, Rafia ; Rbiya, Rabia

14
It has rows and columns…… just like a
TABLE

Also known as MATRIX
EXAMPLE:
A[0][0]

A[0][2]

A[0][3]

A[0][4]

A[1][0]

A[1][1]

A[1][2]

A[1][3]

A[1][4]

A[2][0]

2011

A[0][1]

A[2][1]

A[2][2]

A[2][3]

A[2][4]

Topic: ARRAY by

Atiqa, Rafia ; Rbiya, Rabia

15
HOW TO DECLARE 2D-ARRAY??? This way

Int temps[2][2]
Row * column = 2*2: holding 4 integers
NOW HOW to INITIALIZE IT??????
JUST simple!!!

Int temps[2][2]={{12,14} , {21,41}}:
Value of each is held in {}

2011

Topic: ARRAY by

Atiqa, Rafia ; Rbiya, Rabia

16
In GENERAL:

ARRAY_NAME[row][column]={row}{column}

[SUBSCRIPT]
Both parts of an index MUST be an integer

2011

Topic: ARRAY by

Atiqa, Rafia ; Rbiya, Rabia

17
Nested FOR loops to step through 2D-Array
USUALL FORMAT:

FOR EACH ROW, FOR EACH COLUMN
Do something to array[row][column]
EXAMPLE:
Int team[2][3];
For(int row=0;orw<2;;row++){
For(int row=0;orw<2;;row++){
Team[row][column]=8: }}
2011

Topic: ARRAY by

Atiqa, Rafia ; Rbiya, Rabia

18
2011

Topic: ARRAY by

Atiqa, Rafia ; Rbiya, Rabia

19
Mid versions of BASIC allowed any starting
and ending value. So we could have arrays like
the following:
EXAMPLE:

int years (1998 to 2008)
int tide. level(-5 to +5)
 Many “modern” languages do not allow this
freedom with declaring arrays
2011

Topic: ARRAY by

Atiqa, Rafia ; Rbiya, Rabia

20
* simple and easy to create
Any element of an array can be accessed time

by its index
Random access
Constant size
arrays with arbitrary size (dynamically
allocated array)
array will always hold similar kind of information

2011

Topic: ARRAY by

Atiqa, Rafia ; Rbiya, Rabia

21
We cant change the size of array during run
time
Constant size WITH Constant data-type
Array data structure is not completely
dynamic.
Insertion and deletion of an element in the
array requires to shift the locations

2011

Topic: ARRAY by

Atiqa, Rafia ; Rbiya, Rabia

22
The Prospective of what we have presented
now is to JUST enhance the ability of
ourselves;
Its up to US how we cater down al this in
our practical LIFE…
We have to crave what is perfect from
INSIDE!!!!
2011

Topic: ARRAY by

Atiqa, Rafia ; Rbiya, Rabia

23
1. C How to program, 4th edition by DEITEL
2. WWW.gavilian.edu/adnvantages/histroy/a
rrays.htm

3. WWW.agolist.net/data-strcutures/arrays

2011

Topic: ARRAY by

Atiqa, Rafia ; Rbiya, Rabia

24

Mais conteúdo relacionado

Mais procurados

Mais procurados (9)

Lisp and scheme i
Lisp and scheme iLisp and scheme i
Lisp and scheme i
 
Intermediate code- generation
Intermediate code- generationIntermediate code- generation
Intermediate code- generation
 
Chapter Three(1)
Chapter Three(1)Chapter Three(1)
Chapter Three(1)
 
Lexicalanalyzer
LexicalanalyzerLexicalanalyzer
Lexicalanalyzer
 
Minimizing DFA
Minimizing DFAMinimizing DFA
Minimizing DFA
 
Advanced Functional Programming in Scala
Advanced Functional Programming in ScalaAdvanced Functional Programming in Scala
Advanced Functional Programming in Scala
 
Chapter Seven(2)
Chapter Seven(2)Chapter Seven(2)
Chapter Seven(2)
 
Object Oriented Programming with C++
Object Oriented Programming with C++Object Oriented Programming with C++
Object Oriented Programming with C++
 
Yacc
YaccYacc
Yacc
 

Destaque

Colour models 2012
Colour models 2012Colour models 2012
Colour models 2012Atiqa khan
 
How to Burn CD/DVD for Files in Windows 7/8
How to Burn CD/DVD for Files in Windows 7/8How to Burn CD/DVD for Files in Windows 7/8
How to Burn CD/DVD for Files in Windows 7/8Atiqa khan
 
Lab_4 symbology
Lab_4 symbologyLab_4 symbology
Lab_4 symbologyAtiqa khan
 
Lec_10_Intro to Hyperlinking
Lec_10_Intro to HyperlinkingLec_10_Intro to Hyperlinking
Lec_10_Intro to HyperlinkingAtiqa khan
 
Lab_10_Hyperlinking
Lab_10_HyperlinkingLab_10_Hyperlinking
Lab_10_HyperlinkingAtiqa khan
 
Feasibility and System Definition_2012
Feasibility and System Definition_2012Feasibility and System Definition_2012
Feasibility and System Definition_2012Atiqa khan
 
Hand Book of Formulae and Physical Constants
Hand Book of Formulae and Physical ConstantsHand Book of Formulae and Physical Constants
Hand Book of Formulae and Physical ConstantsAtiqa khan
 
Tasseled Cap transformation Technique in ArcGIS
Tasseled Cap transformation Technique in ArcGISTasseled Cap transformation Technique in ArcGIS
Tasseled Cap transformation Technique in ArcGISAtiqa khan
 

Destaque (9)

Colour models 2012
Colour models 2012Colour models 2012
Colour models 2012
 
How to Burn CD/DVD for Files in Windows 7/8
How to Burn CD/DVD for Files in Windows 7/8How to Burn CD/DVD for Files in Windows 7/8
How to Burn CD/DVD for Files in Windows 7/8
 
Lab_4 symbology
Lab_4 symbologyLab_4 symbology
Lab_4 symbology
 
Lec_10_Intro to Hyperlinking
Lec_10_Intro to HyperlinkingLec_10_Intro to Hyperlinking
Lec_10_Intro to Hyperlinking
 
Hello... !
Hello... !Hello... !
Hello... !
 
Lab_10_Hyperlinking
Lab_10_HyperlinkingLab_10_Hyperlinking
Lab_10_Hyperlinking
 
Feasibility and System Definition_2012
Feasibility and System Definition_2012Feasibility and System Definition_2012
Feasibility and System Definition_2012
 
Hand Book of Formulae and Physical Constants
Hand Book of Formulae and Physical ConstantsHand Book of Formulae and Physical Constants
Hand Book of Formulae and Physical Constants
 
Tasseled Cap transformation Technique in ArcGIS
Tasseled Cap transformation Technique in ArcGISTasseled Cap transformation Technique in ArcGIS
Tasseled Cap transformation Technique in ArcGIS
 

Semelhante a Introduction to Arrays

New features in abap
New features in abapNew features in abap
New features in abapSrihari J
 
(chapter 7) A Concise and Practical Introduction to Programming Algorithms in...
(chapter 7) A Concise and Practical Introduction to Programming Algorithms in...(chapter 7) A Concise and Practical Introduction to Programming Algorithms in...
(chapter 7) A Concise and Practical Introduction to Programming Algorithms in...Frank Nielsen
 
Fp in scala part 1
Fp in scala part 1Fp in scala part 1
Fp in scala part 1Hang Zhao
 
Dot Call interface
Dot Call interfaceDot Call interface
Dot Call interfaceHao Chai
 
Xebicon2013 scala vsjava_final
Xebicon2013 scala vsjava_finalXebicon2013 scala vsjava_final
Xebicon2013 scala vsjava_finalUrs Peter
 
Intro to Apache Spark and Scala, Austin ACM SIGKDD, 7/9/2014
Intro to Apache Spark and Scala, Austin ACM SIGKDD, 7/9/2014Intro to Apache Spark and Scala, Austin ACM SIGKDD, 7/9/2014
Intro to Apache Spark and Scala, Austin ACM SIGKDD, 7/9/2014Roger Huang
 
New features-in-abap-7.4
New features-in-abap-7.4New features-in-abap-7.4
New features-in-abap-7.4swati chavan
 
Scala is java8.next()
Scala is java8.next()Scala is java8.next()
Scala is java8.next()daewon jeong
 
(2) collections algorithms
(2) collections algorithms(2) collections algorithms
(2) collections algorithmsNico Ludwig
 
Homework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdfHomework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdfaroraopticals15
 
(chapter 4) A Concise and Practical Introduction to Programming Algorithms in...
(chapter 4) A Concise and Practical Introduction to Programming Algorithms in...(chapter 4) A Concise and Practical Introduction to Programming Algorithms in...
(chapter 4) A Concise and Practical Introduction to Programming Algorithms in...Frank Nielsen
 

Semelhante a Introduction to Arrays (20)

New features in abap
New features in abapNew features in abap
New features in abap
 
Scala in a nutshell by venkat
Scala in a nutshell by venkatScala in a nutshell by venkat
Scala in a nutshell by venkat
 
(chapter 7) A Concise and Practical Introduction to Programming Algorithms in...
(chapter 7) A Concise and Practical Introduction to Programming Algorithms in...(chapter 7) A Concise and Practical Introduction to Programming Algorithms in...
(chapter 7) A Concise and Practical Introduction to Programming Algorithms in...
 
Fp in scala part 1
Fp in scala part 1Fp in scala part 1
Fp in scala part 1
 
Dot Call interface
Dot Call interfaceDot Call interface
Dot Call interface
 
Scala google
Scala google Scala google
Scala google
 
Xebicon2013 scala vsjava_final
Xebicon2013 scala vsjava_finalXebicon2013 scala vsjava_final
Xebicon2013 scala vsjava_final
 
Big Data Analytics Part2
Big Data Analytics Part2Big Data Analytics Part2
Big Data Analytics Part2
 
Intro to Apache Spark and Scala, Austin ACM SIGKDD, 7/9/2014
Intro to Apache Spark and Scala, Austin ACM SIGKDD, 7/9/2014Intro to Apache Spark and Scala, Austin ACM SIGKDD, 7/9/2014
Intro to Apache Spark and Scala, Austin ACM SIGKDD, 7/9/2014
 
Scala 20140715
Scala 20140715Scala 20140715
Scala 20140715
 
stack.pptx
stack.pptxstack.pptx
stack.pptx
 
New features-in-abap-7.4
New features-in-abap-7.4New features-in-abap-7.4
New features-in-abap-7.4
 
Scala is java8.next()
Scala is java8.next()Scala is java8.next()
Scala is java8.next()
 
Data structures using C
Data structures using CData structures using C
Data structures using C
 
Data structures using c
Data structures using cData structures using c
Data structures using c
 
Special topics in finance lecture 2
Special topics in finance   lecture 2Special topics in finance   lecture 2
Special topics in finance lecture 2
 
Stack
StackStack
Stack
 
(2) collections algorithms
(2) collections algorithms(2) collections algorithms
(2) collections algorithms
 
Homework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdfHomework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdf
 
(chapter 4) A Concise and Practical Introduction to Programming Algorithms in...
(chapter 4) A Concise and Practical Introduction to Programming Algorithms in...(chapter 4) A Concise and Practical Introduction to Programming Algorithms in...
(chapter 4) A Concise and Practical Introduction to Programming Algorithms in...
 

Mais de Atiqa khan

2019_Wingdings Font - Times New Roman
2019_Wingdings Font  - Times New Roman2019_Wingdings Font  - Times New Roman
2019_Wingdings Font - Times New RomanAtiqa khan
 
English Urdu Font in Windows 10 Keyboard
English Urdu Font in Windows 10 KeyboardEnglish Urdu Font in Windows 10 Keyboard
English Urdu Font in Windows 10 KeyboardAtiqa khan
 
2018 Solutions to Sleep Screen
2018 Solutions to Sleep Screen2018 Solutions to Sleep Screen
2018 Solutions to Sleep ScreenAtiqa khan
 
2017 Thesis Check List Doc
2017 Thesis Check List Doc2017 Thesis Check List Doc
2017 Thesis Check List DocAtiqa khan
 
2017 Terms in GIS Town Planning
2017 Terms in GIS Town Planning2017 Terms in GIS Town Planning
2017 Terms in GIS Town PlanningAtiqa khan
 
2017 Pictorial Differences GIS & RS
2017 Pictorial Differences GIS & RS2017 Pictorial Differences GIS & RS
2017 Pictorial Differences GIS & RSAtiqa khan
 
2017 Response Letter to a Journal
2017 Response Letter to a Journal2017 Response Letter to a Journal
2017 Response Letter to a JournalAtiqa khan
 
2017 How to write Author Biography for Journal
2017 How to write Author Biography for Journal2017 How to write Author Biography for Journal
2017 How to write Author Biography for JournalAtiqa khan
 
2017 Information about NUST Engineering
2017 Information about NUST Engineering2017 Information about NUST Engineering
2017 Information about NUST EngineeringAtiqa khan
 
2017 Glossary Of Cartographic Terms
2017 Glossary Of Cartographic Terms2017 Glossary Of Cartographic Terms
2017 Glossary Of Cartographic TermsAtiqa khan
 
2017 Types Of Orbits Brief Explanation
2017 Types Of Orbits Brief Explanation2017 Types Of Orbits Brief Explanation
2017 Types Of Orbits Brief ExplanationAtiqa khan
 
2017 IST Undergraduates Admission Guide for Fall
2017 IST Undergraduates Admission Guide for Fall2017 IST Undergraduates Admission Guide for Fall
2017 IST Undergraduates Admission Guide for FallAtiqa khan
 
2017 Editable Thesis Checklist PDF
2017 Editable Thesis Checklist PDF2017 Editable Thesis Checklist PDF
2017 Editable Thesis Checklist PDFAtiqa khan
 
2017 Basics of GIS
2017 Basics of GIS2017 Basics of GIS
2017 Basics of GISAtiqa khan
 
2016 Tenses in Research Paper
2016 Tenses in Research Paper2016 Tenses in Research Paper
2016 Tenses in Research PaperAtiqa khan
 
Catalog of Earth Satellite Orbits_2017
Catalog of Earth Satellite Orbits_2017Catalog of Earth Satellite Orbits_2017
Catalog of Earth Satellite Orbits_2017Atiqa khan
 
Physiology MBBS Part 2 UHS Paper-2016
Physiology MBBS Part 2 UHS Paper-2016Physiology MBBS Part 2 UHS Paper-2016
Physiology MBBS Part 2 UHS Paper-2016Atiqa khan
 
Islamic Studies-Ethics-Pak Studies MBBS Part 2 UHS Paper-2016
Islamic Studies-Ethics-Pak Studies MBBS Part 2 UHS Paper-2016Islamic Studies-Ethics-Pak Studies MBBS Part 2 UHS Paper-2016
Islamic Studies-Ethics-Pak Studies MBBS Part 2 UHS Paper-2016Atiqa khan
 
Bio Chemistry MBBS Part 2 UHS Paper-2016
Bio Chemistry MBBS Part 2 UHS Paper-2016Bio Chemistry MBBS Part 2 UHS Paper-2016
Bio Chemistry MBBS Part 2 UHS Paper-2016Atiqa khan
 
Editable CD Cover Template_2016
Editable CD Cover Template_2016Editable CD Cover Template_2016
Editable CD Cover Template_2016Atiqa khan
 

Mais de Atiqa khan (20)

2019_Wingdings Font - Times New Roman
2019_Wingdings Font  - Times New Roman2019_Wingdings Font  - Times New Roman
2019_Wingdings Font - Times New Roman
 
English Urdu Font in Windows 10 Keyboard
English Urdu Font in Windows 10 KeyboardEnglish Urdu Font in Windows 10 Keyboard
English Urdu Font in Windows 10 Keyboard
 
2018 Solutions to Sleep Screen
2018 Solutions to Sleep Screen2018 Solutions to Sleep Screen
2018 Solutions to Sleep Screen
 
2017 Thesis Check List Doc
2017 Thesis Check List Doc2017 Thesis Check List Doc
2017 Thesis Check List Doc
 
2017 Terms in GIS Town Planning
2017 Terms in GIS Town Planning2017 Terms in GIS Town Planning
2017 Terms in GIS Town Planning
 
2017 Pictorial Differences GIS & RS
2017 Pictorial Differences GIS & RS2017 Pictorial Differences GIS & RS
2017 Pictorial Differences GIS & RS
 
2017 Response Letter to a Journal
2017 Response Letter to a Journal2017 Response Letter to a Journal
2017 Response Letter to a Journal
 
2017 How to write Author Biography for Journal
2017 How to write Author Biography for Journal2017 How to write Author Biography for Journal
2017 How to write Author Biography for Journal
 
2017 Information about NUST Engineering
2017 Information about NUST Engineering2017 Information about NUST Engineering
2017 Information about NUST Engineering
 
2017 Glossary Of Cartographic Terms
2017 Glossary Of Cartographic Terms2017 Glossary Of Cartographic Terms
2017 Glossary Of Cartographic Terms
 
2017 Types Of Orbits Brief Explanation
2017 Types Of Orbits Brief Explanation2017 Types Of Orbits Brief Explanation
2017 Types Of Orbits Brief Explanation
 
2017 IST Undergraduates Admission Guide for Fall
2017 IST Undergraduates Admission Guide for Fall2017 IST Undergraduates Admission Guide for Fall
2017 IST Undergraduates Admission Guide for Fall
 
2017 Editable Thesis Checklist PDF
2017 Editable Thesis Checklist PDF2017 Editable Thesis Checklist PDF
2017 Editable Thesis Checklist PDF
 
2017 Basics of GIS
2017 Basics of GIS2017 Basics of GIS
2017 Basics of GIS
 
2016 Tenses in Research Paper
2016 Tenses in Research Paper2016 Tenses in Research Paper
2016 Tenses in Research Paper
 
Catalog of Earth Satellite Orbits_2017
Catalog of Earth Satellite Orbits_2017Catalog of Earth Satellite Orbits_2017
Catalog of Earth Satellite Orbits_2017
 
Physiology MBBS Part 2 UHS Paper-2016
Physiology MBBS Part 2 UHS Paper-2016Physiology MBBS Part 2 UHS Paper-2016
Physiology MBBS Part 2 UHS Paper-2016
 
Islamic Studies-Ethics-Pak Studies MBBS Part 2 UHS Paper-2016
Islamic Studies-Ethics-Pak Studies MBBS Part 2 UHS Paper-2016Islamic Studies-Ethics-Pak Studies MBBS Part 2 UHS Paper-2016
Islamic Studies-Ethics-Pak Studies MBBS Part 2 UHS Paper-2016
 
Bio Chemistry MBBS Part 2 UHS Paper-2016
Bio Chemistry MBBS Part 2 UHS Paper-2016Bio Chemistry MBBS Part 2 UHS Paper-2016
Bio Chemistry MBBS Part 2 UHS Paper-2016
 
Editable CD Cover Template_2016
Editable CD Cover Template_2016Editable CD Cover Template_2016
Editable CD Cover Template_2016
 

Último

Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinojohnmickonozaleda
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 

Último (20)

Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipino
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 

Introduction to Arrays

  • 1. 2011 Topic: ARRAY by Atiqa, Rafia ; Rbiya, Rabia 1
  • 2.  Introduction to the ARRAY  Classification  Array Declaration  Array Initialization  Array with FOR Loop  Upper and lower limit of Array  Advantages  Disadvantages  Conclusion 2011 Topic: ARRAY by Atiqa, Rafia ; Rbiya, Rabia 2
  • 3.  An Array is a group of memory location s having same data type  Data type specify the type of data it stores  A group of CONTINOUS memory locations Example: Int A[0][1][2][3][4]  Store JUST single variable  C++ store list values in it  Arrange in Rows/ Columns 2011 Topic: ARRAY by Atiqa, Rafia ; Rbiya, Rabia 3
  • 4. To refer a particular location its Name and its “SUBSCRIPT “is specifies WHAT IS A „SUBSCRIPT‟? The number contained within Square bracket It MUST be an integer or expression If its an integer expression then it is evaluated to describe the subscript EXAMPLE: c[a+b] +=2; if a=5, and b=6 2011 Topic: ARRAY by Atiqa, Rafia ; Rbiya, Rabia 4
  • 5. In some languages (e.g. COBOL) arrays are called “Tables”. An individual value in an array is called an “Element” 2011 Topic: ARRAY by Atiqa, Rafia ; Rbiya, Rabia 5
  • 6. There are divided into following types; 1. One Dimensional Arrays: A[0][1][2][3][4][5][6]………………[n] 2. Two Dimensional Arrays: A[0][0] A[0][1] A[0][2] A[0][3] A[0][4] A[1][0] A[1][1] A[1][2] A[1][3] A[1][4] A[2][0] A[2][1] A[2][2] A[2][3] A[2][4] 3. Multi Dimensional Arrays: 3D, 4D etc 2011 Topic: ARRAY by Atiqa, Rafia ; Rbiya, Rabia 6
  • 7. We Explore The Following Things in this Section: •Arrays Declaration •Arrays Initialization •With FOR Loop 2011 Topic: ARRAY by Atiqa, Rafia ; Rbiya, Rabia 7
  • 8. As just in few steps… Lets have an example of OVERS in a cricket match, its 6 per over We declared it something like that… Int balls[5] Subscript/index Array_name OR…. 2011 Topic: ARRAY by Atiqa, Rafia ; Rbiya, Rabia 8
  • 9. Its still the same!!! Int balls= {1,2,3,4,5,6} More Examplex: Char city= {L,A,H,O,R,E} FLOAT NUM={1.2, 1.3, 1.4 ,1.5 } 2011 Topic: ARRAY by Atiqa, Rafia ; Rbiya, Rabia 9
  • 10. It can be intialized as they declared Do not need to declared the subscript if initial values are defined What's the initial values we are talking about.. Int k[]= {12,13,14,15} WE HAVENT SEPCIFY THE INDEX-ANOTHER NAME AND STIL IT WORKS 2011 Topic: ARRAY by Atiqa, Rafia ; Rbiya, Rabia 10
  • 11. Because array automatically generate the space for it JUST FOR UNDERSTANDING!!! Int k [5]= {12,13,14,15} With index it something look like this….. C++ does not flag out any error if index go out of the bound… HOW????? Char k[7]={A,R,R,A,Y} Even the memory remains empty still it does not cerate any error… 2011 Topic: ARRAY by Atiqa, Rafia ; Rbiya, Rabia 11
  • 12. Almost always needed to steep through the ARRAY The loop is used is “FOR-LOOP” Can not do manipulation easily then BUT WHY?????  Loops are use to REPEATATION so as in the case of array we MUXT declared the index of ≥0 ; for  C++ to pick up the required index it uses the loop. But just not used in some fewer cases 2011 Topic: ARRAY by Atiqa, Rafia ; Rbiya, Rabia 12
  • 13. 2011 Topic: ARRAY by Atiqa, Rafia ; Rbiya, Rabia 13
  • 14. • We „r going to explore the following contents in 1. 2. 3. 4. 5. 2011 this: Introduction to 2D-Array 2D Array with nested FOR loop Upper and lower limit of array Advantages Disadvantages Topic: ARRAY by Atiqa, Rafia ; Rbiya, Rabia 14
  • 15. It has rows and columns…… just like a TABLE Also known as MATRIX EXAMPLE: A[0][0] A[0][2] A[0][3] A[0][4] A[1][0] A[1][1] A[1][2] A[1][3] A[1][4] A[2][0] 2011 A[0][1] A[2][1] A[2][2] A[2][3] A[2][4] Topic: ARRAY by Atiqa, Rafia ; Rbiya, Rabia 15
  • 16. HOW TO DECLARE 2D-ARRAY??? This way Int temps[2][2] Row * column = 2*2: holding 4 integers NOW HOW to INITIALIZE IT?????? JUST simple!!! Int temps[2][2]={{12,14} , {21,41}}: Value of each is held in {} 2011 Topic: ARRAY by Atiqa, Rafia ; Rbiya, Rabia 16
  • 17. In GENERAL: ARRAY_NAME[row][column]={row}{column} [SUBSCRIPT] Both parts of an index MUST be an integer 2011 Topic: ARRAY by Atiqa, Rafia ; Rbiya, Rabia 17
  • 18. Nested FOR loops to step through 2D-Array USUALL FORMAT: FOR EACH ROW, FOR EACH COLUMN Do something to array[row][column] EXAMPLE: Int team[2][3]; For(int row=0;orw<2;;row++){ For(int row=0;orw<2;;row++){ Team[row][column]=8: }} 2011 Topic: ARRAY by Atiqa, Rafia ; Rbiya, Rabia 18
  • 19. 2011 Topic: ARRAY by Atiqa, Rafia ; Rbiya, Rabia 19
  • 20. Mid versions of BASIC allowed any starting and ending value. So we could have arrays like the following: EXAMPLE: int years (1998 to 2008) int tide. level(-5 to +5)  Many “modern” languages do not allow this freedom with declaring arrays 2011 Topic: ARRAY by Atiqa, Rafia ; Rbiya, Rabia 20
  • 21. * simple and easy to create Any element of an array can be accessed time by its index Random access Constant size arrays with arbitrary size (dynamically allocated array) array will always hold similar kind of information 2011 Topic: ARRAY by Atiqa, Rafia ; Rbiya, Rabia 21
  • 22. We cant change the size of array during run time Constant size WITH Constant data-type Array data structure is not completely dynamic. Insertion and deletion of an element in the array requires to shift the locations 2011 Topic: ARRAY by Atiqa, Rafia ; Rbiya, Rabia 22
  • 23. The Prospective of what we have presented now is to JUST enhance the ability of ourselves; Its up to US how we cater down al this in our practical LIFE… We have to crave what is perfect from INSIDE!!!! 2011 Topic: ARRAY by Atiqa, Rafia ; Rbiya, Rabia 23
  • 24. 1. C How to program, 4th edition by DEITEL 2. WWW.gavilian.edu/adnvantages/histroy/a rrays.htm 3. WWW.agolist.net/data-strcutures/arrays 2011 Topic: ARRAY by Atiqa, Rafia ; Rbiya, Rabia 24