SlideShare una empresa de Scribd logo
1 de 17
More About Arrays


Objectives
In this lesson, you will learn to:
 Use two-dimensional and multi-dimensional array in
  C++ program
 Pass arrays to function
 Use enumeration




©NIIT                                OOPS/Lesson 5/Slide 1 of 17
More About Arrays


Multidimensional Arrays
 One-dimensional array can be represented as a single
  row or column
 For example:

    C   A   T        H   Y   0

                C
                A
                T
                H
                Y
                0
©NIIT                              OOPS/Lesson 5/Slide 2 of 17
More About Arrays


Introducing Two-Dimensional Arrays
 If you need to store the standard height versus weight
  chart as given below:
        Height            Weight

        4                 40

        5                 50

        5.5               60


    Two-dimensional array should be used.



©NIIT                                OOPS/Lesson 5/Slide 3 of 17
More About Arrays


Declaring Two-Dimensional Arrays
 The syntax to declare the two-dimensional array is as
  follows:
  data_type variable_name[dimension1_size]
  [dimension2_size];
  where,
  dimension1_size represents the number of rows and
  dimension2_size represents the maximum number of
  elements in one row of the array.




©NIIT                               OOPS/Lesson 5/Slide 4 of 17
More About Arrays


Declaring Two-Dimensional Arrays (Contd..)
 The syntax to initialize an array is as follows:
  Name of an array[row number][column number]=
  value;
 If initialization has some missing values then they are
  automatically initialized with the default value.
 An array can also be initialized at the time of its
  declaration.
 All the values of the two-dimensional array should be
  of the same datatype.



©NIIT                                  OOPS/Lesson 5/Slide 5 of 17
More About Arrays


Two-Dimensional Character Arrays
 Consider the following array definition of a two-
  dimensional character array:
    char arr[2][5];
    The size of the first dimension of the array is 2
    The size of the second dimension of the array is 5
    The total number of elements in the array is 2 * 5 =
    10




©NIIT                                  OOPS/Lesson 5/Slide 6 of 17
More About Arrays


Problem Statement 5.D.1
As a member of a team that is developing billing system
software for Diaz Telecommunication Inc., you have
been assigned the task of creating a software module
that accepts the mobile number and billing amount of five
customers and then display the value in a tabular format.




©NIIT                                OOPS/Lesson 5/Slide 7 of 17
More About Arrays

Just a Minute…
2. Two-Dimensional array can store multiple datatype
   values(T/F).
3. If no value is passed to a character datatype two-
   dimensional array, then it is initialized with space(T/F)
4. What will be the output of following program:
    a. #includeiostream
        int main()
        {float salary[4][5];
        salary[1][1]=1.0;
        salary[2][1]=4.0;
        coutsalary[1][1] ”   “salary[2][1]endl;}
©NIIT                                  OOPS/Lesson 5/Slide 8 of 17
More About Arrays


Just a Minute…(Contd..)
   a. What will be the output of following program:
          #includeiostream
          int main()
          { float salary[4][5];
          salary[1][1]=1.0;
          salary[2][1]=4.0;
          coutsalary[3][2];}
2. Find out an error in following statement:
   int wrong [2][1]={{1,”a”},{2,”b”},{3,”c”}}

  ©NIIT                                    OOPS/Lesson 5/Slide 9 of 17
More About Arrays


Introducing Multi-Dimensional Arrays
 An array with more than two dimensions is known as
  multi-dimensional array.
 The syntax to declare a multi dimensional array is as
  follows:
   datatype array_name[n1][n2][n3]....[nm];
   where
   n1, n2…are the dimensions., which specify the size of
   the array dimension




©NIIT                               OOPS/Lesson 5/Slide 10 of 17
More About Arrays


Problem Statement 5.P.1
Write a program to accept marks of six subjects for ten
students and then display their total marks in a tabular
format.
[Hint: Create a class and function to accept marks,
display marks.]




©NIIT                              OOPS/Lesson 5/Slide 11 of 17
More About Arrays


Passing Array as Parameter
 When there is a need to pass more than one variable
  to a function,then it is preferable to pass all the values
  through an array.
 Arrays are inherently passed to functions by the call
  by reference method.
 For Example:
  void Calculate_TotMarks(int mks[])
    {
    // code
    }

©NIIT                                 OOPS/Lesson 5/Slide 12 of 17
More About Arrays


Problem Statement 5.P.2
Make a program to accept following values in two arrays
 1      2      3             1      2        3
 4      5      6             4      5        6
 7      8      9             7      8        9


Using above two matrix, generate the following output
               2      4      6
               8      10     12
               14     16     18


[Hint: Pass the array as parameter to the function]

©NIIT                                OOPS/Lesson 5/Slide 13 of 17
More About Arrays

Enumeration (ENUM)
 An enumeration is a user-defined type consisting of a
  set of named constants called enumerators
 It serves to create data types, that is not limited to
  either numerical or character constants or Boolean
  values
 The syntax to declare an enum is as follows:
        enum model_name {
         value1,
         value2,
         value3,
         . .};
©NIIT                                OOPS/Lesson 5/Slide 14 of 17
More About Arrays


Enumeration (ENUM) (Contd..)
 By default, the first enumerator has a value of 0
 Each successive enumerator is one larger than the
  value of the previous one, unless you explicitly specify
  a value for a particular enumerator
 An enumerator can be promoted to an integer value.
 Converting an integer to an enumerator requires an
  explicit cast
 The following statement will initialize the enum object
  mycolor to blue:
  mycolor = blue;

©NIIT                                OOPS/Lesson 5/Slide 15 of 17
More About Arrays


Summary
In this lesson, you learned that:
 Two Dimensional arrays are used to store the values
  in a tabular format.
 Two Dimensional arrays consist of rows and
  columns.
 Multidimensional array consist of three or higher
  dimensions.
 Total number of elements in any dimension of arrays
  is the product of all sizes included in the declaration.
 Array can be passed as a parameter to the function,
  to simplify the manipulation on multiple variables.

©NIIT                                OOPS/Lesson 5/Slide 16 of 17
More About Arrays


Summary (Contd..)
In this lesson, you learned that:
 An enumeration is a user-defined type consisting of a
  set of named constants called enumerators.




©NIIT                               OOPS/Lesson 5/Slide 17 of 17

Más contenido relacionado

La actualidad más candente

C programming session 05
C programming session 05C programming session 05
C programming session 05
Dushmanta Nath
 
Tutorial - Support vector machines
Tutorial - Support vector machinesTutorial - Support vector machines
Tutorial - Support vector machines
butest
 
1 arithmetic
1 arithmetic1 arithmetic
1 arithmetic
fyjordan9
 
Introduction To Algorithm [2]
Introduction To Algorithm [2]Introduction To Algorithm [2]
Introduction To Algorithm [2]
ecko_disasterz
 
C programming session 01
C programming session 01C programming session 01
C programming session 01
Dushmanta Nath
 
C programming session 05
C programming session 05C programming session 05
C programming session 05
AjayBahoriya
 

La actualidad más candente (18)

Computer
ComputerComputer
Computer
 
Svm vs ls svm
Svm vs ls svmSvm vs ls svm
Svm vs ls svm
 
Pointer
PointerPointer
Pointer
 
C programming session 05
C programming session 05C programming session 05
C programming session 05
 
Support Vector machine
Support Vector machineSupport Vector machine
Support Vector machine
 
Pointers
 Pointers Pointers
Pointers
 
2.6 support vector machines and associative classifiers revised
2.6 support vector machines and associative classifiers revised2.6 support vector machines and associative classifiers revised
2.6 support vector machines and associative classifiers revised
 
Tutorial - Support vector machines
Tutorial - Support vector machinesTutorial - Support vector machines
Tutorial - Support vector machines
 
Operators
OperatorsOperators
Operators
 
1 arithmetic
1 arithmetic1 arithmetic
1 arithmetic
 
Introduction To Algorithm [2]
Introduction To Algorithm [2]Introduction To Algorithm [2]
Introduction To Algorithm [2]
 
Support Vector Machines- SVM
Support Vector Machines- SVMSupport Vector Machines- SVM
Support Vector Machines- SVM
 
Data structures using C
Data structures using CData structures using C
Data structures using C
 
Pointers - DataStructures
Pointers - DataStructuresPointers - DataStructures
Pointers - DataStructures
 
C programming session 01
C programming session 01C programming session 01
C programming session 01
 
Support Vector Machine (Classification) - Step by Step
Support Vector Machine (Classification) - Step by StepSupport Vector Machine (Classification) - Step by Step
Support Vector Machine (Classification) - Step by Step
 
Support vector machines (svm)
Support vector machines (svm)Support vector machines (svm)
Support vector machines (svm)
 
C programming session 05
C programming session 05C programming session 05
C programming session 05
 

Destacado (14)

Lecture1 classes1
Lecture1 classes1Lecture1 classes1
Lecture1 classes1
 
C++ programming (Array)
C++ programming (Array)C++ programming (Array)
C++ programming (Array)
 
C++ ARRAY WITH EXAMPLES
C++ ARRAY WITH EXAMPLESC++ ARRAY WITH EXAMPLES
C++ ARRAY WITH EXAMPLES
 
Introduction to Array ppt
Introduction to Array pptIntroduction to Array ppt
Introduction to Array ppt
 
Array in c++
Array in c++Array in c++
Array in c++
 
Arrays Class presentation
Arrays Class presentationArrays Class presentation
Arrays Class presentation
 
Lecture17 arrays.ppt
Lecture17 arrays.pptLecture17 arrays.ppt
Lecture17 arrays.ppt
 
Pointer in c++ part1
Pointer in c++ part1Pointer in c++ part1
Pointer in c++ part1
 
C++ Pointers
C++ PointersC++ Pointers
C++ Pointers
 
Arrays In C++
Arrays In C++Arrays In C++
Arrays In C++
 
Unit 6 pointers
Unit 6   pointersUnit 6   pointers
Unit 6 pointers
 
Array in C
Array in CArray in C
Array in C
 
Arrays
ArraysArrays
Arrays
 
Array in c language
Array in c languageArray in c language
Array in c language
 

Similar a Aae oop xp_05

Copyright © 2012 Pearson Addison-Wesley. All rights reserve.docx
Copyright © 2012 Pearson Addison-Wesley.  All rights reserve.docxCopyright © 2012 Pearson Addison-Wesley.  All rights reserve.docx
Copyright © 2012 Pearson Addison-Wesley. All rights reserve.docx
vanesaburnand
 

Similar a Aae oop xp_05 (20)

C sharp chap6
C sharp chap6C sharp chap6
C sharp chap6
 
Lecture_01.2.pptx
Lecture_01.2.pptxLecture_01.2.pptx
Lecture_01.2.pptx
 
Savitch Ch 07
Savitch Ch 07Savitch Ch 07
Savitch Ch 07
 
Savitch Ch 07
Savitch Ch 07Savitch Ch 07
Savitch Ch 07
 
Ocs752 unit 2
Ocs752   unit 2Ocs752   unit 2
Ocs752 unit 2
 
Savitch ch 07
Savitch ch 07Savitch ch 07
Savitch ch 07
 
Arrays C#
Arrays C#Arrays C#
Arrays C#
 
Chap 6 c++
Chap 6 c++Chap 6 c++
Chap 6 c++
 
Chap 6 c++
Chap 6 c++Chap 6 c++
Chap 6 c++
 
VCE Unit 01 (2).pptx
VCE Unit 01 (2).pptxVCE Unit 01 (2).pptx
VCE Unit 01 (2).pptx
 
Chapter1.pptx
Chapter1.pptxChapter1.pptx
Chapter1.pptx
 
Array & Exception Handling in C# (CSharp)
Array & Exception Handling in C# (CSharp)Array & Exception Handling in C# (CSharp)
Array & Exception Handling in C# (CSharp)
 
Ch8 Arrays
Ch8 ArraysCh8 Arrays
Ch8 Arrays
 
Object Oriented Programming - 5.1. Array
Object Oriented Programming - 5.1. ArrayObject Oriented Programming - 5.1. Array
Object Oriented Programming - 5.1. Array
 
CP Handout#9
CP Handout#9CP Handout#9
CP Handout#9
 
Unit 3
Unit 3 Unit 3
Unit 3
 
Array,MULTI ARRAY, IN C
Array,MULTI ARRAY, IN CArray,MULTI ARRAY, IN C
Array,MULTI ARRAY, IN C
 
COM1407: Arrays
COM1407: ArraysCOM1407: Arrays
COM1407: Arrays
 
Copyright © 2012 Pearson Addison-Wesley. All rights reserve.docx
Copyright © 2012 Pearson Addison-Wesley.  All rights reserve.docxCopyright © 2012 Pearson Addison-Wesley.  All rights reserve.docx
Copyright © 2012 Pearson Addison-Wesley. All rights reserve.docx
 
Java: Introduction to Arrays
Java: Introduction to ArraysJava: Introduction to Arrays
Java: Introduction to Arrays
 

Más de Niit Care (20)

Ajs 1 b
Ajs 1 bAjs 1 b
Ajs 1 b
 
Ajs 4 b
Ajs 4 bAjs 4 b
Ajs 4 b
 
Ajs 4 a
Ajs 4 aAjs 4 a
Ajs 4 a
 
Ajs 4 c
Ajs 4 cAjs 4 c
Ajs 4 c
 
Ajs 3 b
Ajs 3 bAjs 3 b
Ajs 3 b
 
Ajs 3 a
Ajs 3 aAjs 3 a
Ajs 3 a
 
Ajs 3 c
Ajs 3 cAjs 3 c
Ajs 3 c
 
Ajs 2 b
Ajs 2 bAjs 2 b
Ajs 2 b
 
Ajs 2 a
Ajs 2 aAjs 2 a
Ajs 2 a
 
Ajs 2 c
Ajs 2 cAjs 2 c
Ajs 2 c
 
Ajs 1 a
Ajs 1 aAjs 1 a
Ajs 1 a
 
Ajs 1 c
Ajs 1 cAjs 1 c
Ajs 1 c
 
Dacj 4 2-c
Dacj 4 2-cDacj 4 2-c
Dacj 4 2-c
 
Dacj 4 2-b
Dacj 4 2-bDacj 4 2-b
Dacj 4 2-b
 
Dacj 4 2-a
Dacj 4 2-aDacj 4 2-a
Dacj 4 2-a
 
Dacj 4 1-c
Dacj 4 1-cDacj 4 1-c
Dacj 4 1-c
 
Dacj 4 1-b
Dacj 4 1-bDacj 4 1-b
Dacj 4 1-b
 
Dacj 4 1-a
Dacj 4 1-aDacj 4 1-a
Dacj 4 1-a
 
Dacj 1-2 b
Dacj 1-2 bDacj 1-2 b
Dacj 1-2 b
 
Dacj 1-3 c
Dacj 1-3 cDacj 1-3 c
Dacj 1-3 c
 

Último

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 

Aae oop xp_05

  • 1. More About Arrays Objectives In this lesson, you will learn to: Use two-dimensional and multi-dimensional array in C++ program Pass arrays to function Use enumeration ©NIIT OOPS/Lesson 5/Slide 1 of 17
  • 2. More About Arrays Multidimensional Arrays One-dimensional array can be represented as a single row or column For example: C A T H Y 0 C A T H Y 0 ©NIIT OOPS/Lesson 5/Slide 2 of 17
  • 3. More About Arrays Introducing Two-Dimensional Arrays If you need to store the standard height versus weight chart as given below: Height Weight 4 40 5 50 5.5 60 Two-dimensional array should be used. ©NIIT OOPS/Lesson 5/Slide 3 of 17
  • 4. More About Arrays Declaring Two-Dimensional Arrays The syntax to declare the two-dimensional array is as follows: data_type variable_name[dimension1_size] [dimension2_size]; where, dimension1_size represents the number of rows and dimension2_size represents the maximum number of elements in one row of the array. ©NIIT OOPS/Lesson 5/Slide 4 of 17
  • 5. More About Arrays Declaring Two-Dimensional Arrays (Contd..) The syntax to initialize an array is as follows: Name of an array[row number][column number]= value; If initialization has some missing values then they are automatically initialized with the default value. An array can also be initialized at the time of its declaration. All the values of the two-dimensional array should be of the same datatype. ©NIIT OOPS/Lesson 5/Slide 5 of 17
  • 6. More About Arrays Two-Dimensional Character Arrays Consider the following array definition of a two- dimensional character array: char arr[2][5]; The size of the first dimension of the array is 2 The size of the second dimension of the array is 5 The total number of elements in the array is 2 * 5 = 10 ©NIIT OOPS/Lesson 5/Slide 6 of 17
  • 7. More About Arrays Problem Statement 5.D.1 As a member of a team that is developing billing system software for Diaz Telecommunication Inc., you have been assigned the task of creating a software module that accepts the mobile number and billing amount of five customers and then display the value in a tabular format. ©NIIT OOPS/Lesson 5/Slide 7 of 17
  • 8. More About Arrays Just a Minute… 2. Two-Dimensional array can store multiple datatype values(T/F). 3. If no value is passed to a character datatype two- dimensional array, then it is initialized with space(T/F) 4. What will be the output of following program: a. #includeiostream int main() {float salary[4][5]; salary[1][1]=1.0; salary[2][1]=4.0; coutsalary[1][1] ” “salary[2][1]endl;} ©NIIT OOPS/Lesson 5/Slide 8 of 17
  • 9. More About Arrays Just a Minute…(Contd..) a. What will be the output of following program: #includeiostream int main() { float salary[4][5]; salary[1][1]=1.0; salary[2][1]=4.0; coutsalary[3][2];} 2. Find out an error in following statement: int wrong [2][1]={{1,”a”},{2,”b”},{3,”c”}} ©NIIT OOPS/Lesson 5/Slide 9 of 17
  • 10. More About Arrays Introducing Multi-Dimensional Arrays An array with more than two dimensions is known as multi-dimensional array. The syntax to declare a multi dimensional array is as follows: datatype array_name[n1][n2][n3]....[nm]; where n1, n2…are the dimensions., which specify the size of the array dimension ©NIIT OOPS/Lesson 5/Slide 10 of 17
  • 11. More About Arrays Problem Statement 5.P.1 Write a program to accept marks of six subjects for ten students and then display their total marks in a tabular format. [Hint: Create a class and function to accept marks, display marks.] ©NIIT OOPS/Lesson 5/Slide 11 of 17
  • 12. More About Arrays Passing Array as Parameter When there is a need to pass more than one variable to a function,then it is preferable to pass all the values through an array. Arrays are inherently passed to functions by the call by reference method. For Example: void Calculate_TotMarks(int mks[]) { // code } ©NIIT OOPS/Lesson 5/Slide 12 of 17
  • 13. More About Arrays Problem Statement 5.P.2 Make a program to accept following values in two arrays 1 2 3 1 2 3 4 5 6 4 5 6 7 8 9 7 8 9 Using above two matrix, generate the following output 2 4 6 8 10 12 14 16 18 [Hint: Pass the array as parameter to the function] ©NIIT OOPS/Lesson 5/Slide 13 of 17
  • 14. More About Arrays Enumeration (ENUM) An enumeration is a user-defined type consisting of a set of named constants called enumerators It serves to create data types, that is not limited to either numerical or character constants or Boolean values The syntax to declare an enum is as follows: enum model_name { value1, value2, value3, . .}; ©NIIT OOPS/Lesson 5/Slide 14 of 17
  • 15. More About Arrays Enumeration (ENUM) (Contd..) By default, the first enumerator has a value of 0 Each successive enumerator is one larger than the value of the previous one, unless you explicitly specify a value for a particular enumerator An enumerator can be promoted to an integer value. Converting an integer to an enumerator requires an explicit cast The following statement will initialize the enum object mycolor to blue: mycolor = blue; ©NIIT OOPS/Lesson 5/Slide 15 of 17
  • 16. More About Arrays Summary In this lesson, you learned that: Two Dimensional arrays are used to store the values in a tabular format. Two Dimensional arrays consist of rows and columns. Multidimensional array consist of three or higher dimensions. Total number of elements in any dimension of arrays is the product of all sizes included in the declaration. Array can be passed as a parameter to the function, to simplify the manipulation on multiple variables. ©NIIT OOPS/Lesson 5/Slide 16 of 17
  • 17. More About Arrays Summary (Contd..) In this lesson, you learned that: An enumeration is a user-defined type consisting of a set of named constants called enumerators. ©NIIT OOPS/Lesson 5/Slide 17 of 17