SlideShare a Scribd company logo
1 of 11
ARRAY TECHNIQUES
Provides us with a very simple way of referring to and performing
computations on collection of data that share some common attribute
Array name and suffix.
A one-dimensional array.
Perform the same computations on collections of data.
Deep Prajapati
8866188126
ARRAY ORDER REVERSAL
Problem:
Rearrange the element in an array so that they appear in reverse order.
Algorithm Description:
 Establish the array of [1,…n] of n element to be reversed.
 Compute r the number of exchanges needed to be reverse the
array.
 While there are still pairs of array element to be exchanged
 (a) Exchange the ith
element with the [n-i+1]th
element.
 Return the reversed array.
ARRAY COUNTING OR HISTOGRAMING
Problem :
Given a set of n students’ examination marks (in the range 0 to 100 )
make count of the number of student that obtained each
possible mark.
Algorithm Description :
 Prompt and read in n the number of marks to be processed.
 Initialize all elements of the counting array a(0,..100) to zero.
 While there are still marks to be processed, repeatedly do
(a) Read next mark m,
(b) Add one to the count in location m in the counting array.
 Write out the marks frequency count distribution.
FINDING THE MAXIMUM NUMBER IN A SET
Problem :
Find the maximum number in a set of n numbers.
Algorithm Description :
 Establish an array a[1,…n] of n elements where n>=1.
 Set temporary maximum max to first array element.
 While less than n array elements have been considered do.
(a) If next element greater than current maximum max then assign
to max.
 Return maximum max for the array of n elements.
REMOVAL OF DUPLICATES FROM AN ORDERED
ARRAY
Problem :
Remove all duplicates from an ordered array and construct the array
accordingly.
Algorithm description :
 Establish the array a[1…n] of n elements.
 Set loop index I to 2 allow correct termination.
 Compare successive pairs of elements until a duplicate is
encountered then set unique element count j.
 While all pairs have not been examined do
(a) If next pair not duplicate then
(a.1) add one to unique element count j.
(a.2) move later element of pairs to array position determined by the
unique element count j.
PARTITIONING AN ARRAY
Problem :
Given a randomly ordered array. of n elements, partition the elements
into two subset such that elements <=x are in one subset and
elements >x are in the other subset.
Algorithm Description :
 Establish the array a[1…n] and the partitioning value x.
 Move the two partitions towards each other until a wrongly
placed pair of elements is encountered. Allow for special cases of
x being outside the range of array values.
 While the two partitions have not met or crossed over do
(a) Exchange the wrongly partitioned pair and extend both partitions
inwards by one element;
(b) Extend left partition while elements less than or equal to x;
(c) Extend the right partition while elements are greater than x.
 Return the partitioning index p and the partitioned array.
FINDING THE kth
SMALLEST ELEMENT
Problem :
Given a randomly ordered array of n elements determine the kth
smallest element in the
set.
Algorithm Description :
 Establish a[1…n] and the requirement that the kth
smallest element is sought.
 While the left and right partitions do not overlap do
(a) Choose a[k] as the current partitioning value x;
(b) Set I to the upper limit l of the left partition;
(c) Set j to the lower limit u of of the right partition;
(d) While I has not advanced beyond k and j is greater than or equal to k do
(d.1) extend the left partition while a[I]<x;
(d.2) extend the right partition while z<a[j];
(d.3) exchange of [I] and reduce j by 1;
(e) If kth
smallest in right partition, update upper limit u of left partition;
(f) If kth
smallest in right partition update lower limit l of right partition.
(3) Return the partitioned array with elements <=a[k] in the first k position in the array.
ARRAYS
Introduction :
An array is a group of related data items that share a common name.
Declaration of Arrays :
Type variable-name[size];
The maximum number of elements that can be stored inside the array.
An array to contain a maximum of 10 integer constants.
When declaring character arrays. We must always allow one extra
element space for the null terminator.
INITIALIZATION OF ARRAYS
We can initialize the elements of arrays in the same way as the ordinary
variables when they are declared. The general form of initialization of
array is
Static type array-name [size] = {list of values};
The values in the list are separated by commas. For example, the
statement
Static float total[5] {0,0,0};
There is no convenient way to initialize only selected elements.
There is no shortcut method for initializing a large number of array
elements like the one available in FORTRAN.
TWO DIMENSIONALARRAYS
So far we have discussed the array variable that can store a list of values.
There will be situation where a table of values will have to be stores.
Considered the following data table, which shows the value of sales of
three items by four sales girls;
Two-dimensional arrays arrays declared as follows:-
Type array_name [row_size][column_size];
Note that unlike most other languages, which use one pair of parentheses
with commas to separate sizes, C places each size in its own set of
brackets.
INITIALIZING TWO-DIMENSIONALARRAYS
Static int table[2][3] = {0,0,0,1,1,1};
Initializes the elements of the first row to zero and the second row to
one. The initialization is done row by row. The above statement can be
equivalently written as
Static int table[2][3] = {{0,0,0}, {1,1,1};
By surrounding the elements of each row by braces.
We can also initialize a two-dimensional array in the form of a matrix as
shown below:
Static int table[2][3] = {
{0,0,0}
{1,1,1}
};

More Related Content

What's hot

Array operations
Array operationsArray operations
Array operationsRazzaaa
 
A Presentation About Array Manipulation(Insertion & Deletion in an array)
A Presentation About Array Manipulation(Insertion & Deletion in an array)A Presentation About Array Manipulation(Insertion & Deletion in an array)
A Presentation About Array Manipulation(Insertion & Deletion in an array)Imdadul Himu
 
Hashing Technique In Data Structures
Hashing Technique In Data StructuresHashing Technique In Data Structures
Hashing Technique In Data StructuresSHAKOOR AB
 
Datatypes in python
Datatypes in pythonDatatypes in python
Datatypes in pythoneShikshak
 
Two dimensional arrays
Two dimensional arraysTwo dimensional arrays
Two dimensional arraysNeeru Mittal
 
Array in c programming
Array in c programmingArray in c programming
Array in c programmingMazharul Islam
 
Data Structures (CS8391)
Data Structures (CS8391)Data Structures (CS8391)
Data Structures (CS8391)Elavarasi K
 
Queue Implementation Using Array & Linked List
Queue Implementation Using Array & Linked ListQueue Implementation Using Array & Linked List
Queue Implementation Using Array & Linked ListPTCL
 
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 structureVardhil Patel
 
Arrays 1D and 2D , and multi dimensional
Arrays 1D and 2D , and multi dimensional Arrays 1D and 2D , and multi dimensional
Arrays 1D and 2D , and multi dimensional Appili Vamsi Krishna
 
Array data structure
Array data structureArray data structure
Array data structuremaamir farooq
 
concept of Array, 1D & 2D array
concept of Array, 1D & 2D arrayconcept of Array, 1D & 2D array
concept of Array, 1D & 2D arraySangani Ankur
 
Data Structures- Part5 recursion
Data Structures- Part5 recursionData Structures- Part5 recursion
Data Structures- Part5 recursionAbdullah Al-hazmy
 

What's hot (20)

Array ppt
Array pptArray ppt
Array ppt
 
Array operations
Array operationsArray operations
Array operations
 
Queues
QueuesQueues
Queues
 
A Presentation About Array Manipulation(Insertion & Deletion in an array)
A Presentation About Array Manipulation(Insertion & Deletion in an array)A Presentation About Array Manipulation(Insertion & Deletion in an array)
A Presentation About Array Manipulation(Insertion & Deletion in an array)
 
Hashing Technique In Data Structures
Hashing Technique In Data StructuresHashing Technique In Data Structures
Hashing Technique In Data Structures
 
Datatypes in python
Datatypes in pythonDatatypes in python
Datatypes in python
 
Two dimensional arrays
Two dimensional arraysTwo dimensional arrays
Two dimensional arrays
 
Heapsort using Heap
Heapsort using HeapHeapsort using Heap
Heapsort using Heap
 
Hashing
HashingHashing
Hashing
 
Array in c programming
Array in c programmingArray in c programming
Array in c programming
 
Python array
Python arrayPython array
Python array
 
Data Structures (CS8391)
Data Structures (CS8391)Data Structures (CS8391)
Data Structures (CS8391)
 
Queue Implementation Using Array & Linked List
Queue Implementation Using Array & Linked ListQueue Implementation Using Array & Linked List
Queue Implementation Using Array & Linked List
 
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
 
Python tuple
Python   tuplePython   tuple
Python tuple
 
Arrays 1D and 2D , and multi dimensional
Arrays 1D and 2D , and multi dimensional Arrays 1D and 2D , and multi dimensional
Arrays 1D and 2D , and multi dimensional
 
Array data structure
Array data structureArray data structure
Array data structure
 
concept of Array, 1D & 2D array
concept of Array, 1D & 2D arrayconcept of Array, 1D & 2D array
concept of Array, 1D & 2D array
 
Arrays in c
Arrays in cArrays in c
Arrays in c
 
Data Structures- Part5 recursion
Data Structures- Part5 recursionData Structures- Part5 recursion
Data Structures- Part5 recursion
 

Similar to Array Presentation

Similar to Array Presentation (20)

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
 
Unit ii data structure-converted
Unit  ii data structure-convertedUnit  ii data structure-converted
Unit ii data structure-converted
 
Address calculation-sort
Address calculation-sortAddress calculation-sort
Address calculation-sort
 
We would like to build a generic list in such a way that we can start.pdf
 We would like to build a generic list in such a way that we can start.pdf We would like to build a generic list in such a way that we can start.pdf
We would like to build a generic list in such a way that we can start.pdf
 
2 data structure in R
2 data structure in R2 data structure in R
2 data structure in R
 
Data Structure
Data StructureData Structure
Data Structure
 
Introduction To Matrix
Introduction To MatrixIntroduction To Matrix
Introduction To Matrix
 
Introduction to Arrays in C
Introduction to Arrays in CIntroduction to Arrays in C
Introduction to Arrays in C
 
Acm aleppo cpc training seventh session
Acm aleppo cpc training seventh sessionAcm aleppo cpc training seventh session
Acm aleppo cpc training seventh session
 
Data structure
Data structureData structure
Data structure
 
Module 4- Arrays and Strings
Module 4- Arrays and StringsModule 4- Arrays and Strings
Module 4- Arrays and Strings
 
Algo>Arrays
Algo>ArraysAlgo>Arrays
Algo>Arrays
 
Introduction to R
Introduction to RIntroduction to R
Introduction to R
 
ARRAYS
ARRAYSARRAYS
ARRAYS
 
Ada notes
Ada notesAda notes
Ada notes
 
611+tutorial
611+tutorial611+tutorial
611+tutorial
 
Array 31.8.2020 updated
Array 31.8.2020 updatedArray 31.8.2020 updated
Array 31.8.2020 updated
 
Unit 2
Unit 2Unit 2
Unit 2
 
Data Structure Midterm Lesson Arrays
Data Structure Midterm Lesson ArraysData Structure Midterm Lesson Arrays
Data Structure Midterm Lesson Arrays
 
Arrays in C.pptx
Arrays in C.pptxArrays in C.pptx
Arrays in C.pptx
 

Recently uploaded

Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 

Recently uploaded (20)

Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 

Array Presentation

  • 1. ARRAY TECHNIQUES Provides us with a very simple way of referring to and performing computations on collection of data that share some common attribute Array name and suffix. A one-dimensional array. Perform the same computations on collections of data. Deep Prajapati 8866188126
  • 2. ARRAY ORDER REVERSAL Problem: Rearrange the element in an array so that they appear in reverse order. Algorithm Description:  Establish the array of [1,…n] of n element to be reversed.  Compute r the number of exchanges needed to be reverse the array.  While there are still pairs of array element to be exchanged  (a) Exchange the ith element with the [n-i+1]th element.  Return the reversed array.
  • 3. ARRAY COUNTING OR HISTOGRAMING Problem : Given a set of n students’ examination marks (in the range 0 to 100 ) make count of the number of student that obtained each possible mark. Algorithm Description :  Prompt and read in n the number of marks to be processed.  Initialize all elements of the counting array a(0,..100) to zero.  While there are still marks to be processed, repeatedly do (a) Read next mark m, (b) Add one to the count in location m in the counting array.  Write out the marks frequency count distribution.
  • 4. FINDING THE MAXIMUM NUMBER IN A SET Problem : Find the maximum number in a set of n numbers. Algorithm Description :  Establish an array a[1,…n] of n elements where n>=1.  Set temporary maximum max to first array element.  While less than n array elements have been considered do. (a) If next element greater than current maximum max then assign to max.  Return maximum max for the array of n elements.
  • 5. REMOVAL OF DUPLICATES FROM AN ORDERED ARRAY Problem : Remove all duplicates from an ordered array and construct the array accordingly. Algorithm description :  Establish the array a[1…n] of n elements.  Set loop index I to 2 allow correct termination.  Compare successive pairs of elements until a duplicate is encountered then set unique element count j.  While all pairs have not been examined do (a) If next pair not duplicate then (a.1) add one to unique element count j. (a.2) move later element of pairs to array position determined by the unique element count j.
  • 6. PARTITIONING AN ARRAY Problem : Given a randomly ordered array. of n elements, partition the elements into two subset such that elements <=x are in one subset and elements >x are in the other subset. Algorithm Description :  Establish the array a[1…n] and the partitioning value x.  Move the two partitions towards each other until a wrongly placed pair of elements is encountered. Allow for special cases of x being outside the range of array values.  While the two partitions have not met or crossed over do (a) Exchange the wrongly partitioned pair and extend both partitions inwards by one element; (b) Extend left partition while elements less than or equal to x; (c) Extend the right partition while elements are greater than x.  Return the partitioning index p and the partitioned array.
  • 7. FINDING THE kth SMALLEST ELEMENT Problem : Given a randomly ordered array of n elements determine the kth smallest element in the set. Algorithm Description :  Establish a[1…n] and the requirement that the kth smallest element is sought.  While the left and right partitions do not overlap do (a) Choose a[k] as the current partitioning value x; (b) Set I to the upper limit l of the left partition; (c) Set j to the lower limit u of of the right partition; (d) While I has not advanced beyond k and j is greater than or equal to k do (d.1) extend the left partition while a[I]<x; (d.2) extend the right partition while z<a[j]; (d.3) exchange of [I] and reduce j by 1; (e) If kth smallest in right partition, update upper limit u of left partition; (f) If kth smallest in right partition update lower limit l of right partition. (3) Return the partitioned array with elements <=a[k] in the first k position in the array.
  • 8. ARRAYS Introduction : An array is a group of related data items that share a common name. Declaration of Arrays : Type variable-name[size]; The maximum number of elements that can be stored inside the array. An array to contain a maximum of 10 integer constants. When declaring character arrays. We must always allow one extra element space for the null terminator.
  • 9. INITIALIZATION OF ARRAYS We can initialize the elements of arrays in the same way as the ordinary variables when they are declared. The general form of initialization of array is Static type array-name [size] = {list of values}; The values in the list are separated by commas. For example, the statement Static float total[5] {0,0,0}; There is no convenient way to initialize only selected elements. There is no shortcut method for initializing a large number of array elements like the one available in FORTRAN.
  • 10. TWO DIMENSIONALARRAYS So far we have discussed the array variable that can store a list of values. There will be situation where a table of values will have to be stores. Considered the following data table, which shows the value of sales of three items by four sales girls; Two-dimensional arrays arrays declared as follows:- Type array_name [row_size][column_size]; Note that unlike most other languages, which use one pair of parentheses with commas to separate sizes, C places each size in its own set of brackets.
  • 11. INITIALIZING TWO-DIMENSIONALARRAYS Static int table[2][3] = {0,0,0,1,1,1}; Initializes the elements of the first row to zero and the second row to one. The initialization is done row by row. The above statement can be equivalently written as Static int table[2][3] = {{0,0,0}, {1,1,1}; By surrounding the elements of each row by braces. We can also initialize a two-dimensional array in the form of a matrix as shown below: Static int table[2][3] = { {0,0,0} {1,1,1} };