SlideShare a Scribd company logo
1 of 20
2 DIMENSIONAL
ARRAY
GROUP A ‘EVEREST’
Amit Budachhetri
Anil Pokhrel
Ajit Pudasaini
Rikriti Koirala
Roji shrestha
Puja Neupane 1
CONTENTS
• Basic array
• Difference between 1D &2D
• 2 Dimension Array
• Syntax of 2 D
• Processing Two-Dimensional Arrays
• Declaration of 2 D
• Examples of 2D
• Conclusion
2
Array
• Consecutive group of memory location
• All of which have the same type
• We have 1D,2D 3D types of array
• 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
Difference between 1D &2D
• 1d array contains single row and multiple
columns
• 2d array contains multiple row and multiple
columns
• 2d array is a collection of 1d array placed one
below
• 1d has only the length, but 2d has both the
length and width
4
5
2D Array
• Two-dimensional Array: a collection of a fixed
number of components arranged in two dimensions
• All components are of the same type
• The two expressions row size and column size specify
the number of rows and the number of columns,
respectively, in the array
• Two-dimensional arrays are sometimes called
matrices or tables
6
Syntax
• The syntax for declaring a two-dimensional
array is:
Data Type Array Name[rowsize][columnsize];
where row size and column size are
expressions yielding positive integer values
Example:int data[3][4];
―Data is a TWO Dimensional array of size 3*4
elements
7
Lets observe the table:
8
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
9
Declaration
• A 2-D array within a function is declared as
follows:
• #define ROW 3
• define COL 5
• ..... what(....)
• {
• int a[ROW][COL] .... ;
• ..........................
• }
10
11
1.Program to transpose a matrix.
#include <stdio.h>
#define MAXROW 10
#define MAXCOL 10
int main()
{
int matrix[MAXROW][MAXCOL];
int i,j,r,c;
printf("Enter number of Rows :");
scanf("%d",&r);
printf("Enter number of Cols :");
scanf("%d",&c);
printf("nEnter matrix elements :n");
for(i=0;i< r;i++)
{
for(j=0;j< c;j++) 12
{
printf("Enter element [%d,%d] : ",i+1,j+1);
scanf("%d",&matrix[i][j]);
}
}
/*Transpose a matrix */
printf("nTranspose Matrix is :");
for(i=0;i< c;i++)
{
for(j=0;j< r;j++) {
printf("%dt",matrix[j][i]); /*print elements*/
}
printf("n"); /*after each row print new line*/
}
return 0;
} 13
OUTPUT
• Enter number of Rows :2
• Enter number of Cols :3
• Enter matrix elements :
• Enter element [1,1] : 1
• Enter element [1,2] : 2
• Enter element [1,3] : 3
• Enter element [2,1] : 4
• Enter element [2,2] : 5
• Enter element [2,3] : 6
• Transpose Matrix is : 1 4
2 5
3 6 14
2.Program to find multiplication table
• #include<stdio.h>
• #define R5
• #define C5 void main()
• {
• int R, C, product[R][C]; int i, j;
printf("multiplication tablenn");
• Printf(“ “)
• for(j=1; j<=C; j++)
• {
• printf("%4d",j);
• printf("n"); 15
• printf("__________________________");
• }
• for(i=0; i<R; i++)
• {
• R=i+1;
• printf("%2d",R);
• for(j=1; j<=C; j++)
• {
• C=j;
• product[i][j]=R*C;
• printf("%4d",product[i][j]);
• }
• printf("n");
• } 16
OUTPUT
17
Conclusion
• Two-dimensional array are those type of array, which
has finite number of rows and finite number of
columns
• The rule for giving the array name is same as the
ordinary variable
• The row size and column size should be an individual
constant.
• during declaration the maximum number of rows
and maximum number of column should be specified
for processing all array elements 18
Reference
• Google.com
• E.Balaguruswamy- Programming in ANSI
• Teacher’s notes (MR.LOK PRAKASH
PANDEY)
19
20

More Related Content

What's hot

Lec 25 - arrays-strings
Lec 25 - arrays-stringsLec 25 - arrays-strings
Lec 25 - arrays-stringsPrincess Sam
 
Array Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayArray Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayimtiazalijoono
 
Multi dimensional array
Multi dimensional arrayMulti dimensional array
Multi dimensional arrayRajendran
 
Java Foundations: Maps, Lambda and Stream API
Java Foundations: Maps, Lambda and Stream APIJava Foundations: Maps, Lambda and Stream API
Java Foundations: Maps, Lambda and Stream APISvetlin Nakov
 
Two dimensional array
Two dimensional arrayTwo dimensional array
Two dimensional arrayRajendran
 
C Programming : Arrays
C Programming : ArraysC Programming : Arrays
C Programming : ArraysGagan Deep
 
Aaa ped-4- Data manipulation: Numpy
Aaa ped-4- Data manipulation: Numpy Aaa ped-4- Data manipulation: Numpy
Aaa ped-4- Data manipulation: Numpy AminaRepo
 
Multidimensional array in C
Multidimensional array in CMultidimensional array in C
Multidimensional array in CSmit Parikh
 
Sql 99 and_some_techniques
Sql 99 and_some_techniquesSql 99 and_some_techniques
Sql 99 and_some_techniquesAlexey Kiselyov
 
Refinement Types for Haskell
Refinement Types for HaskellRefinement Types for Haskell
Refinement Types for HaskellMartin Ockajak
 
Java Foundations: Lists, ArrayList<T>
Java Foundations: Lists, ArrayList<T>Java Foundations: Lists, ArrayList<T>
Java Foundations: Lists, ArrayList<T>Svetlin Nakov
 
Comparing Haskell & Scala
Comparing Haskell & ScalaComparing Haskell & Scala
Comparing Haskell & ScalaMartin Ockajak
 
Scala for Java Developers
Scala for Java DevelopersScala for Java Developers
Scala for Java DevelopersMartin Ockajak
 

What's hot (20)

1 D Arrays in C++
1 D Arrays in C++1 D Arrays in C++
1 D Arrays in C++
 
Java Arrays
Java ArraysJava Arrays
Java Arrays
 
2D Array
2D Array 2D Array
2D Array
 
Lec 25 - arrays-strings
Lec 25 - arrays-stringsLec 25 - arrays-strings
Lec 25 - arrays-strings
 
Array Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayArray Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional array
 
Multi dimensional array
Multi dimensional arrayMulti dimensional array
Multi dimensional array
 
Array lecture
Array lectureArray lecture
Array lecture
 
2- Dimensional Arrays
2- Dimensional Arrays2- Dimensional Arrays
2- Dimensional Arrays
 
Java Foundations: Maps, Lambda and Stream API
Java Foundations: Maps, Lambda and Stream APIJava Foundations: Maps, Lambda and Stream API
Java Foundations: Maps, Lambda and Stream API
 
Two dimensional array
Two dimensional arrayTwo dimensional array
Two dimensional array
 
Java arrays
Java arraysJava arrays
Java arrays
 
C Programming : Arrays
C Programming : ArraysC Programming : Arrays
C Programming : Arrays
 
Arrays
ArraysArrays
Arrays
 
Aaa ped-4- Data manipulation: Numpy
Aaa ped-4- Data manipulation: Numpy Aaa ped-4- Data manipulation: Numpy
Aaa ped-4- Data manipulation: Numpy
 
Multidimensional array in C
Multidimensional array in CMultidimensional array in C
Multidimensional array in C
 
Sql 99 and_some_techniques
Sql 99 and_some_techniquesSql 99 and_some_techniques
Sql 99 and_some_techniques
 
Refinement Types for Haskell
Refinement Types for HaskellRefinement Types for Haskell
Refinement Types for Haskell
 
Java Foundations: Lists, ArrayList<T>
Java Foundations: Lists, ArrayList<T>Java Foundations: Lists, ArrayList<T>
Java Foundations: Lists, ArrayList<T>
 
Comparing Haskell & Scala
Comparing Haskell & ScalaComparing Haskell & Scala
Comparing Haskell & Scala
 
Scala for Java Developers
Scala for Java DevelopersScala for Java Developers
Scala for Java Developers
 

Similar to 2D ARRAY TUTORIAL

C (PPS)Programming for problem solving.pptx
C (PPS)Programming for problem solving.pptxC (PPS)Programming for problem solving.pptx
C (PPS)Programming for problem solving.pptxrohinitalekar1
 
Array and string in C++_093547 analysis.pptx
Array and string in C++_093547 analysis.pptxArray and string in C++_093547 analysis.pptx
Array and string in C++_093547 analysis.pptxJumanneChiyanda
 
DS Unit 1.pptx
DS Unit 1.pptxDS Unit 1.pptx
DS Unit 1.pptxchin463670
 
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...AntareepMajumder
 
Basic of array and data structure, data structure basics, array, address calc...
Basic of array and data structure, data structure basics, array, address calc...Basic of array and data structure, data structure basics, array, address calc...
Basic of array and data structure, data structure basics, array, address calc...nsitlokeshjain
 
Getting started cpp full
Getting started cpp   fullGetting started cpp   full
Getting started cpp fullVõ Hòa
 
2. Array in Data Structure
2. Array in Data Structure2. Array in Data Structure
2. Array in Data StructureMandeep Singh
 
Basics of Python
Basics of PythonBasics of Python
Basics of PythonEase3
 
C-Programming Arrays.pptx
C-Programming  Arrays.pptxC-Programming  Arrays.pptx
C-Programming Arrays.pptxSKUP1
 
C-Programming Arrays.pptx
C-Programming  Arrays.pptxC-Programming  Arrays.pptx
C-Programming Arrays.pptxLECO9
 
R_CheatSheet.pdf
R_CheatSheet.pdfR_CheatSheet.pdf
R_CheatSheet.pdfMariappanR3
 

Similar to 2D ARRAY TUTORIAL (20)

Arrays 06.ppt
Arrays 06.pptArrays 06.ppt
Arrays 06.ppt
 
C (PPS)Programming for problem solving.pptx
C (PPS)Programming for problem solving.pptxC (PPS)Programming for problem solving.pptx
C (PPS)Programming for problem solving.pptx
 
ReviewArrays.ppt
ReviewArrays.pptReviewArrays.ppt
ReviewArrays.ppt
 
Array and string in C++_093547 analysis.pptx
Array and string in C++_093547 analysis.pptxArray and string in C++_093547 analysis.pptx
Array and string in C++_093547 analysis.pptx
 
DS Unit 1.pptx
DS Unit 1.pptxDS Unit 1.pptx
DS Unit 1.pptx
 
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
 
Basic of array and data structure, data structure basics, array, address calc...
Basic of array and data structure, data structure basics, array, address calc...Basic of array and data structure, data structure basics, array, address calc...
Basic of array and data structure, data structure basics, array, address calc...
 
Session 4
Session 4Session 4
Session 4
 
C
CC
C
 
Array i imp
Array  i impArray  i imp
Array i imp
 
About Array
About ArrayAbout Array
About Array
 
Python lecture 05
Python lecture 05Python lecture 05
Python lecture 05
 
Getting started cpp full
Getting started cpp   fullGetting started cpp   full
Getting started cpp full
 
2. Array in Data Structure
2. Array in Data Structure2. Array in Data Structure
2. Array in Data Structure
 
Basics of Python
Basics of PythonBasics of Python
Basics of Python
 
C-Programming Arrays.pptx
C-Programming  Arrays.pptxC-Programming  Arrays.pptx
C-Programming Arrays.pptx
 
C-Programming Arrays.pptx
C-Programming  Arrays.pptxC-Programming  Arrays.pptx
C-Programming Arrays.pptx
 
2D arrays
2D arrays2D arrays
2D arrays
 
R_CheatSheet.pdf
R_CheatSheet.pdfR_CheatSheet.pdf
R_CheatSheet.pdf
 
Arrays in C++
Arrays in C++Arrays in C++
Arrays in C++
 

More from Anil Pokhrel

Internet and intranet
Internet and intranetInternet and intranet
Internet and intranetAnil Pokhrel
 
Measure of dispersion
Measure of dispersionMeasure of dispersion
Measure of dispersionAnil Pokhrel
 
Correlation and regression
Correlation and regressionCorrelation and regression
Correlation and regressionAnil Pokhrel
 
Correlation analysis
Correlation analysis Correlation analysis
Correlation analysis Anil Pokhrel
 
Function in C Programming
Function in C ProgrammingFunction in C Programming
Function in C ProgrammingAnil Pokhrel
 
Priority scheuling
Priority scheuling Priority scheuling
Priority scheuling Anil Pokhrel
 
Operating system file system
Operating system file systemOperating system file system
Operating system file systemAnil Pokhrel
 
object oriented programming OOP
object oriented programming OOPobject oriented programming OOP
object oriented programming OOPAnil Pokhrel
 
Numerical method runge kutta method
Numerical method runge kutta methodNumerical method runge kutta method
Numerical method runge kutta methodAnil Pokhrel
 
Management profile ppt
Management profile pptManagement profile ppt
Management profile pptAnil Pokhrel
 
Bus and memory transfer
Bus and memory transferBus and memory transfer
Bus and memory transferAnil Pokhrel
 
Computer architecture data representation
Computer architecture  data representationComputer architecture  data representation
Computer architecture data representationAnil Pokhrel
 
Management and leadership skills
Management and leadership skillsManagement and leadership skills
Management and leadership skillsAnil Pokhrel
 
color detection using open cv
color detection using open cvcolor detection using open cv
color detection using open cvAnil Pokhrel
 
Client-server technology in web design
Client-server technology in web designClient-server technology in web design
Client-server technology in web designAnil Pokhrel
 
Software Engineering requirements
Software Engineering requirementsSoftware Engineering requirements
Software Engineering requirementsAnil Pokhrel
 
I WAY (SUPER HIGHWAY INFORMATION)
I WAY (SUPER HIGHWAY INFORMATION)I WAY (SUPER HIGHWAY INFORMATION)
I WAY (SUPER HIGHWAY INFORMATION)Anil Pokhrel
 

More from Anil Pokhrel (20)

System software
System softwareSystem software
System software
 
Internet and intranet
Internet and intranetInternet and intranet
Internet and intranet
 
Measure of dispersion
Measure of dispersionMeasure of dispersion
Measure of dispersion
 
Correlation and regression
Correlation and regressionCorrelation and regression
Correlation and regression
 
Correlation analysis
Correlation analysis Correlation analysis
Correlation analysis
 
Function in C Programming
Function in C ProgrammingFunction in C Programming
Function in C Programming
 
Priority scheuling
Priority scheuling Priority scheuling
Priority scheuling
 
Operating system file system
Operating system file systemOperating system file system
Operating system file system
 
object oriented programming OOP
object oriented programming OOPobject oriented programming OOP
object oriented programming OOP
 
Numerical method runge kutta method
Numerical method runge kutta methodNumerical method runge kutta method
Numerical method runge kutta method
 
Management profile ppt
Management profile pptManagement profile ppt
Management profile ppt
 
Impact of error
Impact of errorImpact of error
Impact of error
 
Control statement
Control statementControl statement
Control statement
 
Bus and memory transfer
Bus and memory transferBus and memory transfer
Bus and memory transfer
 
Computer architecture data representation
Computer architecture  data representationComputer architecture  data representation
Computer architecture data representation
 
Management and leadership skills
Management and leadership skillsManagement and leadership skills
Management and leadership skills
 
color detection using open cv
color detection using open cvcolor detection using open cv
color detection using open cv
 
Client-server technology in web design
Client-server technology in web designClient-server technology in web design
Client-server technology in web design
 
Software Engineering requirements
Software Engineering requirementsSoftware Engineering requirements
Software Engineering requirements
 
I WAY (SUPER HIGHWAY INFORMATION)
I WAY (SUPER HIGHWAY INFORMATION)I WAY (SUPER HIGHWAY INFORMATION)
I WAY (SUPER HIGHWAY INFORMATION)
 

Recently uploaded

XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 

Recently uploaded (20)

XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 

2D ARRAY TUTORIAL

  • 1. 2 DIMENSIONAL ARRAY GROUP A ‘EVEREST’ Amit Budachhetri Anil Pokhrel Ajit Pudasaini Rikriti Koirala Roji shrestha Puja Neupane 1
  • 2. CONTENTS • Basic array • Difference between 1D &2D • 2 Dimension Array • Syntax of 2 D • Processing Two-Dimensional Arrays • Declaration of 2 D • Examples of 2D • Conclusion 2
  • 3. Array • Consecutive group of memory location • All of which have the same type • We have 1D,2D 3D types of array • 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
  • 4. Difference between 1D &2D • 1d array contains single row and multiple columns • 2d array contains multiple row and multiple columns • 2d array is a collection of 1d array placed one below • 1d has only the length, but 2d has both the length and width 4
  • 5. 5
  • 6. 2D Array • Two-dimensional Array: a collection of a fixed number of components arranged in two dimensions • All components are of the same type • The two expressions row size and column size specify the number of rows and the number of columns, respectively, in the array • Two-dimensional arrays are sometimes called matrices or tables 6
  • 7. Syntax • The syntax for declaring a two-dimensional array is: Data Type Array Name[rowsize][columnsize]; where row size and column size are expressions yielding positive integer values Example:int data[3][4]; ―Data is a TWO Dimensional array of size 3*4 elements 7
  • 8. Lets observe the table: 8
  • 9. 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 9
  • 10. Declaration • A 2-D array within a function is declared as follows: • #define ROW 3 • define COL 5 • ..... what(....) • { • int a[ROW][COL] .... ; • .......................... • } 10
  • 11. 11
  • 12. 1.Program to transpose a matrix. #include <stdio.h> #define MAXROW 10 #define MAXCOL 10 int main() { int matrix[MAXROW][MAXCOL]; int i,j,r,c; printf("Enter number of Rows :"); scanf("%d",&r); printf("Enter number of Cols :"); scanf("%d",&c); printf("nEnter matrix elements :n"); for(i=0;i< r;i++) { for(j=0;j< c;j++) 12
  • 13. { printf("Enter element [%d,%d] : ",i+1,j+1); scanf("%d",&matrix[i][j]); } } /*Transpose a matrix */ printf("nTranspose Matrix is :"); for(i=0;i< c;i++) { for(j=0;j< r;j++) { printf("%dt",matrix[j][i]); /*print elements*/ } printf("n"); /*after each row print new line*/ } return 0; } 13
  • 14. OUTPUT • Enter number of Rows :2 • Enter number of Cols :3 • Enter matrix elements : • Enter element [1,1] : 1 • Enter element [1,2] : 2 • Enter element [1,3] : 3 • Enter element [2,1] : 4 • Enter element [2,2] : 5 • Enter element [2,3] : 6 • Transpose Matrix is : 1 4 2 5 3 6 14
  • 15. 2.Program to find multiplication table • #include<stdio.h> • #define R5 • #define C5 void main() • { • int R, C, product[R][C]; int i, j; printf("multiplication tablenn"); • Printf(“ “) • for(j=1; j<=C; j++) • { • printf("%4d",j); • printf("n"); 15
  • 16. • printf("__________________________"); • } • for(i=0; i<R; i++) • { • R=i+1; • printf("%2d",R); • for(j=1; j<=C; j++) • { • C=j; • product[i][j]=R*C; • printf("%4d",product[i][j]); • } • printf("n"); • } 16
  • 18. Conclusion • Two-dimensional array are those type of array, which has finite number of rows and finite number of columns • The rule for giving the array name is same as the ordinary variable • The row size and column size should be an individual constant. • during declaration the maximum number of rows and maximum number of column should be specified for processing all array elements 18
  • 19. Reference • Google.com • E.Balaguruswamy- Programming in ANSI • Teacher’s notes (MR.LOK PRAKASH PANDEY) 19
  • 20. 20