SlideShare a Scribd company logo
Topic:
2D Array
Group Members:
 Ehatsham Riaz
Array:
 Consecutive group of memory locations
― All of which have the same type
Index:
 Position number used to refer to a specific
location/element
 Place in square brackets
― Must be positive integer or integer expression
 First element has index zero
Definition:
Two-dimensional Array: a
collection of a fixed number of
components arranged in two
dimensions
All components are of the same type
Syntax:
 The syntax for declaring a two-dimensional array
is:
DataType ArrayName[rowsize][colsize];
where rowsize and colsize are expressions yielding
positive integer values
Example: int data[3][4];
― Data is a TWO Dimensional array of size 3*4
elements
 The two expressions rowsize and colsize specify
the number of rows and the number of columns,
respectively, in the array
 Two-dimensional arrays are sometimes called
matrices or tables
 Multiple arrays of the same type can be declared
in a single declaration
―Use a comma-separated list of names and
sizes
int sales[10][5];
Each array Element is identified by its Row and
column position
Accessing Array Components
 The syntax to access a component of a two-
dimensional array is:
arrayName[indexexp1][indexexp2]
where indexexp1 and indexexp2 are expressions
yielding nonnegative integer values
 indexexp1 specifies the row position and
indexexp2 specifies the column position
inStock[1][3]=15;
Processing Two-Dimensional
Arrays:
 A two-dimensional array can be processed
in three different ways:
1. Process the entire array
2. Process a particular row of the array, called
row processing
3. Process a particular column of the array,
called column processing
 Each row and each column of a two-dimensional
array is a one-dimensional array
 When processing a particular row or column of a
two-dimensional array
― we use algorithms similar to processing one-
dimensional arrays
Example:
Initialisation of 2D Array
#include <iostream>
int main()
{
int _2DArray[5][6] = { { 1, 2, 3, 4, 5, 6},
{ 7, 8, 9, 0, 1, 2},
{ 3, 4, 5} };
for (int i = 0; i < 5; i++)
{
for (int j = 0; j < 6; j++)
{
cout << _2DArray [i][j];
}
cout << endl;
}
cout << endl;
return 0;
}
Output:
1 2 3 4 5 6
7 8 9 0 1 2
3 4 5 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
Example
Write a function in c++ which accepts a 2D array of integers
and its size as arguments and displays the elements of middle
row and the elements of middle column.
const int S = 5;
void DisplayMidle( int A[S][S], int S)
{ int mid = S/2;
int i;
cout << “ n Middle row”;
for (i=0 ; i<S; i++)
cout << A[ mid ][ i ]<< “ “;
cout<< “ n Middle Column ”;
for (i = 0; i<S; i++)
cout<<A[i][ mid ]<< “ “
cout << endl;
}
Thank You 

More Related Content

What's hot

Arrays
ArraysArrays
Array in c language
Array in c languageArray in c language
Array in c languagehome
 
Arrays
ArraysArrays
Python dictionary
Python   dictionaryPython   dictionary
Python dictionary
Mohammed Sikander
 
Introduction to Array ppt
Introduction to Array pptIntroduction to Array ppt
Introduction to Array ppt
sandhya yadav
 
Data Structures in Python
Data Structures in PythonData Structures in Python
Data Structures in Python
Devashish Kumar
 
Arrays in c
Arrays in cArrays in c
Arrays in c
Jeeva Nanthini
 
Sparse matrix and its representation data structure
Sparse matrix and its representation data structureSparse matrix and its representation data structure
Sparse matrix and its representation data structure
Vardhil Patel
 
Data structures using c
Data structures using cData structures using c
Data structures using c
Prof. Dr. K. Adisesha
 
Command line arguments
Command line argumentsCommand line arguments
Command line arguments
Ashok Raj
 
Array ppt
Array pptArray ppt
Array ppt
Kaushal Mehta
 
Python exception handling
Python   exception handlingPython   exception handling
Python exception handling
Mohammed Sikander
 
C++ Arrays
C++ ArraysC++ Arrays
C++ Arrays
أحمد محمد
 
Two dimensional array
Two dimensional arrayTwo dimensional array
Two dimensional array
Rajendran
 
Programming in c Arrays
Programming in c ArraysProgramming in c Arrays
Programming in c Arrays
janani thirupathi
 
Array
ArrayArray
List in Python
List in PythonList in Python
List in Python
Siddique Ibrahim
 
Basics of Object Oriented Programming in Python
Basics of Object Oriented Programming in PythonBasics of Object Oriented Programming in Python
Basics of Object Oriented Programming in Python
Sujith Kumar
 

What's hot (20)

Arrays
ArraysArrays
Arrays
 
Array in c language
Array in c languageArray in c language
Array in c language
 
Arrays
ArraysArrays
Arrays
 
Python dictionary
Python   dictionaryPython   dictionary
Python dictionary
 
Introduction to Array ppt
Introduction to Array pptIntroduction to Array ppt
Introduction to Array ppt
 
Data Structures in Python
Data Structures in PythonData Structures in Python
Data Structures in Python
 
Arrays in c
Arrays in cArrays in c
Arrays in c
 
Function in C program
Function in C programFunction in C program
Function in C program
 
Sparse matrix and its representation data structure
Sparse matrix and its representation data structureSparse matrix and its representation data structure
Sparse matrix and its representation data structure
 
Data structures using c
Data structures using cData structures using c
Data structures using c
 
Command line arguments
Command line argumentsCommand line arguments
Command line arguments
 
Array ppt
Array pptArray ppt
Array ppt
 
Python exception handling
Python   exception handlingPython   exception handling
Python exception handling
 
C++ Arrays
C++ ArraysC++ Arrays
C++ Arrays
 
Two dimensional array
Two dimensional arrayTwo dimensional array
Two dimensional array
 
Programming in c Arrays
Programming in c ArraysProgramming in c Arrays
Programming in c Arrays
 
Array
ArrayArray
Array
 
List in Python
List in PythonList in Python
List in Python
 
Basics of Object Oriented Programming in Python
Basics of Object Oriented Programming in PythonBasics of Object Oriented Programming in Python
Basics of Object Oriented Programming in Python
 
Arrays in Java
Arrays in JavaArrays in Java
Arrays in Java
 

Viewers also liked

2- Dimensional Arrays
2- Dimensional Arrays2- Dimensional Arrays
2- Dimensional Arrays
Education Front
 
array
array array
Two dimensional array
Two dimensional arrayTwo dimensional array
Two dimensional array
Rajendran
 
Array Presentation (EngineerBaBu.com)
Array Presentation (EngineerBaBu.com)Array Presentation (EngineerBaBu.com)
Array Presentation (EngineerBaBu.com)
EngineerBabu
 
Arrays In C++
Arrays In C++Arrays In C++
Arrays In C++
Awais Alam
 
Array in C
Array in CArray in C
Array in C
Kamal Acharya
 
C Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpointC Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpoint
JavaTpoint.Com
 

Viewers also liked (9)

2- Dimensional Arrays
2- Dimensional Arrays2- Dimensional Arrays
2- Dimensional Arrays
 
array
array array
array
 
Two dimensional array
Two dimensional arrayTwo dimensional array
Two dimensional array
 
1 D Arrays in C++
1 D Arrays in C++1 D Arrays in C++
1 D Arrays in C++
 
Array Presentation (EngineerBaBu.com)
Array Presentation (EngineerBaBu.com)Array Presentation (EngineerBaBu.com)
Array Presentation (EngineerBaBu.com)
 
Arrays In C++
Arrays In C++Arrays In C++
Arrays In C++
 
Array in C
Array in CArray in C
Array in C
 
C Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpointC Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpoint
 
Slideshare ppt
Slideshare pptSlideshare ppt
Slideshare ppt
 

Similar to 2D Array

array-191103180006.pdf
array-191103180006.pdfarray-191103180006.pdf
array-191103180006.pdf
HEMAHEMS5
 
ARRAYS
ARRAYSARRAYS
ARRAYS
muniryaseen
 
Chapter 4 (Part I) - Array and Strings.pdf
Chapter 4 (Part I) - Array and Strings.pdfChapter 4 (Part I) - Array and Strings.pdf
Chapter 4 (Part I) - Array and Strings.pdf
KirubelWondwoson1
 
Arrays
ArraysArrays
Array,MULTI ARRAY, IN C
Array,MULTI ARRAY, IN CArray,MULTI ARRAY, IN C
Array,MULTI ARRAY, IN C
naveed jamali
 
Arrays in C++
Arrays in C++Arrays in C++
Arrays in C++
Kashif Nawab
 
Module 7 : Arrays
Module 7 : ArraysModule 7 : Arrays
Module 7 : Arrays
Prem Kumar Badri
 
Unit4 Slides
Unit4 SlidesUnit4 Slides
Unit4 Slides
Rakesh Roshan
 
Arrays
ArraysArrays
Intro to C# - part 2.pptx emerging technology
Intro to C# - part 2.pptx emerging technologyIntro to C# - part 2.pptx emerging technology
Intro to C# - part 2.pptx emerging technology
worldchannel
 
Arrays
ArraysArrays
Arrays & Strings
Arrays & StringsArrays & Strings
Arrays & Strings
Munazza-Mah-Jabeen
 
Lecture 2.8 Arrays.pdf
Lecture 2.8 Arrays.pdfLecture 2.8 Arrays.pdf
Lecture 2.8 Arrays.pdf
MianSaeedAkbar1
 
arrays in c# including Classes handling arrays
arrays in c#  including Classes handling arraysarrays in c#  including Classes handling arrays
arrays in c# including Classes handling arrays
JayanthiM19
 
C++ lecture 04
C++ lecture 04C++ lecture 04
C++ lecture 04
HNDE Labuduwa Galle
 
Chapter 13.pptx
Chapter 13.pptxChapter 13.pptx
Chapter 13.pptx
AnisZahirahAzman
 
Introduction to Arrays in C
Introduction to Arrays in CIntroduction to Arrays in C
Introduction to Arrays in C
Thesis Scientist Private Limited
 

Similar to 2D Array (20)

array-191103180006.pdf
array-191103180006.pdfarray-191103180006.pdf
array-191103180006.pdf
 
ARRAYS
ARRAYSARRAYS
ARRAYS
 
Chapter 4 (Part I) - Array and Strings.pdf
Chapter 4 (Part I) - Array and Strings.pdfChapter 4 (Part I) - Array and Strings.pdf
Chapter 4 (Part I) - Array and Strings.pdf
 
Arrays
ArraysArrays
Arrays
 
Array,MULTI ARRAY, IN C
Array,MULTI ARRAY, IN CArray,MULTI ARRAY, IN C
Array,MULTI ARRAY, IN C
 
Arrays in C++
Arrays in C++Arrays in C++
Arrays in C++
 
Module 7 : Arrays
Module 7 : ArraysModule 7 : Arrays
Module 7 : Arrays
 
Unit4 Slides
Unit4 SlidesUnit4 Slides
Unit4 Slides
 
Arrays
ArraysArrays
Arrays
 
Intro to C# - part 2.pptx emerging technology
Intro to C# - part 2.pptx emerging technologyIntro to C# - part 2.pptx emerging technology
Intro to C# - part 2.pptx emerging technology
 
Arrays
ArraysArrays
Arrays
 
Arrays
ArraysArrays
Arrays
 
Algo>Arrays
Algo>ArraysAlgo>Arrays
Algo>Arrays
 
Arrays & Strings
Arrays & StringsArrays & Strings
Arrays & Strings
 
Lecture 2.8 Arrays.pdf
Lecture 2.8 Arrays.pdfLecture 2.8 Arrays.pdf
Lecture 2.8 Arrays.pdf
 
Ch08
Ch08Ch08
Ch08
 
arrays in c# including Classes handling arrays
arrays in c#  including Classes handling arraysarrays in c#  including Classes handling arrays
arrays in c# including Classes handling arrays
 
C++ lecture 04
C++ lecture 04C++ lecture 04
C++ lecture 04
 
Chapter 13.pptx
Chapter 13.pptxChapter 13.pptx
Chapter 13.pptx
 
Introduction to Arrays in C
Introduction to Arrays in CIntroduction to Arrays in C
Introduction to Arrays in C
 

More from Ehatsham Riaz

whats is Grammar and TYPES OF GRAMMAR
whats is Grammar and TYPES OF GRAMMARwhats is Grammar and TYPES OF GRAMMAR
whats is Grammar and TYPES OF GRAMMAR
Ehatsham Riaz
 
Stress management and stress handling hand out
Stress management and stress handling hand outStress management and stress handling hand out
Stress management and stress handling hand out
Ehatsham Riaz
 
STRESS MANAGEMENT And STRESS HANDLING
STRESS MANAGEMENT And STRESS HANDLINGSTRESS MANAGEMENT And STRESS HANDLING
STRESS MANAGEMENT And STRESS HANDLING
Ehatsham Riaz
 
Mealy and moore machine
Mealy and moore machineMealy and moore machine
Mealy and moore machine
Ehatsham Riaz
 
Roza suom
Roza suomRoza suom
Roza suom
Ehatsham Riaz
 
suffixation
suffixation suffixation
suffixation
Ehatsham Riaz
 
English report
English reportEnglish report
English report
Ehatsham Riaz
 
Muhammad Raza Saeed Tech-Entrepreneur
Muhammad Raza Saeed Tech-Entrepreneur Muhammad Raza Saeed Tech-Entrepreneur
Muhammad Raza Saeed Tech-Entrepreneur
Ehatsham Riaz
 
Jahan ara - TECH Entrepreneure
Jahan ara - TECH EntrepreneureJahan ara - TECH Entrepreneure
Jahan ara - TECH Entrepreneure
Ehatsham Riaz
 
History Of Calculas
History Of CalculasHistory Of Calculas
History Of Calculas
Ehatsham Riaz
 

More from Ehatsham Riaz (10)

whats is Grammar and TYPES OF GRAMMAR
whats is Grammar and TYPES OF GRAMMARwhats is Grammar and TYPES OF GRAMMAR
whats is Grammar and TYPES OF GRAMMAR
 
Stress management and stress handling hand out
Stress management and stress handling hand outStress management and stress handling hand out
Stress management and stress handling hand out
 
STRESS MANAGEMENT And STRESS HANDLING
STRESS MANAGEMENT And STRESS HANDLINGSTRESS MANAGEMENT And STRESS HANDLING
STRESS MANAGEMENT And STRESS HANDLING
 
Mealy and moore machine
Mealy and moore machineMealy and moore machine
Mealy and moore machine
 
Roza suom
Roza suomRoza suom
Roza suom
 
suffixation
suffixation suffixation
suffixation
 
English report
English reportEnglish report
English report
 
Muhammad Raza Saeed Tech-Entrepreneur
Muhammad Raza Saeed Tech-Entrepreneur Muhammad Raza Saeed Tech-Entrepreneur
Muhammad Raza Saeed Tech-Entrepreneur
 
Jahan ara - TECH Entrepreneure
Jahan ara - TECH EntrepreneureJahan ara - TECH Entrepreneure
Jahan ara - TECH Entrepreneure
 
History Of Calculas
History Of CalculasHistory Of Calculas
History Of Calculas
 

Recently uploaded

AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 

Recently uploaded (20)

AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 

2D Array

  • 2. Array:  Consecutive group of memory locations ― All of which have the same type Index:  Position number used to refer to a specific location/element  Place in square brackets ― Must be positive integer or integer expression  First element has index zero
  • 3. Definition: Two-dimensional Array: a collection of a fixed number of components arranged in two dimensions All components are of the same type
  • 4. Syntax:  The syntax for declaring a two-dimensional array is: DataType ArrayName[rowsize][colsize]; where rowsize and colsize are expressions yielding positive integer values Example: int data[3][4]; ― Data is a TWO Dimensional array of size 3*4 elements
  • 5.  The two expressions rowsize and colsize specify the number of rows and the number of columns, respectively, in the array  Two-dimensional arrays are sometimes called matrices or tables  Multiple arrays of the same type can be declared in a single declaration ―Use a comma-separated list of names and sizes
  • 7. Each array Element is identified by its Row and column position
  • 8. Accessing Array Components  The syntax to access a component of a two- dimensional array is: arrayName[indexexp1][indexexp2] where indexexp1 and indexexp2 are expressions yielding nonnegative integer values  indexexp1 specifies the row position and indexexp2 specifies the column position
  • 10. Processing Two-Dimensional Arrays:  A two-dimensional array can be processed in three different ways: 1. Process the entire array 2. Process a particular row of the array, called row processing 3. Process a particular column of the array, called column processing
  • 11.  Each row and each column of a two-dimensional array is a one-dimensional array  When processing a particular row or column of a two-dimensional array ― we use algorithms similar to processing one- dimensional arrays
  • 13.
  • 14.
  • 15.
  • 16. Initialisation of 2D Array #include <iostream> int main() { int _2DArray[5][6] = { { 1, 2, 3, 4, 5, 6}, { 7, 8, 9, 0, 1, 2}, { 3, 4, 5} }; for (int i = 0; i < 5; i++) { for (int j = 0; j < 6; j++) { cout << _2DArray [i][j]; } cout << endl; } cout << endl; return 0; }
  • 17. Output: 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  • 18. Example Write a function in c++ which accepts a 2D array of integers and its size as arguments and displays the elements of middle row and the elements of middle column. const int S = 5; void DisplayMidle( int A[S][S], int S) { int mid = S/2; int i; cout << “ n Middle row”; for (i=0 ; i<S; i++) cout << A[ mid ][ i ]<< “ “; cout<< “ n Middle Column ”; for (i = 0; i<S; i++) cout<<A[i][ mid ]<< “ “ cout << endl; }

Editor's Notes

  1. Memory slotsss ban jate han