SlideShare a Scribd company logo
1 of 28
Chapter 5 : ARRAY 5.1 Introduction  5.2 One Dimensional Array 5.2.1 Declaring Array   5.2.2  Array Initialization   5.2.3  Array Referencing   5.2.4  Array to Function   5.3 Two Dimensional Array 5.3.1 Two Dimensional Array Declaration 5.3.2 Two Dimensional Array Initialization 5.3.3 Two Dimensional Array Referencing
5.1  Introduction ,[object Object],[object Object],[object Object],[object Object]
5.1  Introduction (Cont..) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
5.1  Introduction (Cont..) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
5.2 One Dimensional Array ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
5.2.1   Declaring Array ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Array size Array name Array type
5.2.1   Declaring Array (cont).. ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
5.2.1 Declaring Array (cont).. ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
5.2.2 Array Initialization ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
5.2.2 Array Initialization (cont..) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
5.2.2 Array Initialization (cont…) ,[object Object],[object Object],[object Object],[object Object],[object Object]
5.2.3 Array Referencing ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
5.2.3 Array Referencing(cont…) ,[object Object],[object Object],[object Object],Name of array ( all elements of this array, have the same name,  x ) Position number of the element within array  x “ array subscript” 4.05  3.45  3.21  6.55  10.23
5.2.3 Array Referencing(cont…)   ,[object Object],[object Object],[object Object],[object Object],[object Object],printf (“ %.f ”, Mark[0]); Mark[3] =25.0; sum= Mark[0] + Mark[1]; sum += Mark[2]; Mark[3] += 1.0; Mark[2] = Mark [0] + Mark [1]; 16.0 12.0 6.0 8.0 2.5 12.0 14.0 10.5
5.2.4  Passing Array to Function ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
5.2.4  Passing Array to Function (cont..) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Pass the value of  diod[2] , 4.7 to function print_third_diod Copy the value of  diod[2]   from the main function
5.2.4  Passing Array to Function (cont..) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
5.2.4  Passing Array to Function (cont..) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Entire array passed to  function  count_average relay[0] relay[1] relay[2] relay[3] relay[4]
5.2.4  Passing Array to Function (cont..)   ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
5.3  Two Dimensional Array ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
5.3.1 Two Dimensional Array Declaration(cont..) ,[object Object],[object Object],[object Object],[object Object]
5.3.1 Two Dimensional Array Declaration(cont..) ,[object Object],[object Object],row1 row2 row3 column1  column2 column3  column4 array name row subscript column subscript row [0]-[2] column [0]-[3] exam_score[2][3] exam_score[2][2] exam_score[2][1] exam_score[2][0] exam_score[1][3] exam_score[1][2] exam_score[1][1] exam_score[1][0] exam_score[0][3] exam_score[0][2] exam_score[0][1] exam_score[0][0]
5.3.1 Two Dimensional Array Declaration(cont..) ,[object Object],[object Object],[object Object],exam_score[0][0] exam_score[0][1] exam_score[0][2] exam_score[0][3] exam_score[1][0] exam_score[1][1] exam_score[1][2] exam_score[1][3] exam_score[2][0] exam_score[2][1] exam_score[2][2] exam_score[2][3] 98 78 67 91 81 71 92 82 72 90 80 70
5.3.2 Two Dimensional Array Initialization ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
5.3.2 Two Dimensional Array Initialization(cont…) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
5.3.2 Two Dimensional Array Initialization(cont..) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
5.3.3 Two Dimensional Array Referencing ,[object Object],[object Object],[object Object],[object Object],[object Object]
5.3.3 Two Dimensional Array Referencing (cont…) Example Program 5.8 #include<stdio.h> void main( ) { int exam_score[3][4]={{70,80,90,72},{82,92,71,81},{91,67,78,98}}; for(int row=0; row<3; row++) {   for(int column=0; column<4; column++){ exam_score[row][column]= exam_score[row][column]+1; printf(&quot;[%d][%d] = %d&quot;,row,column,exam_score[row][column]);   } } } //Program Output [0][0] = 71 [0][1] = 81 [0][2] = 91 [0][3] = 73 [1][0] = 83 [1][1] = 93 [1][2] = 72 [1][3] = 82 [2][0] = 92 [2][1] = 68 [2][2] = 79 [2][3] = 99

More Related Content

What's hot

Switch function
Switch functionSwitch function
Switch function
Muuluu
 
Secret sharing schemes
Secret sharing schemesSecret sharing schemes
Secret sharing schemes
wonloser
 

What's hot (20)

Es6 to es5
Es6 to es5Es6 to es5
Es6 to es5
 
Network programming in java - PPT
Network programming in java - PPTNetwork programming in java - PPT
Network programming in java - PPT
 
Secure Coding for NodeJS
Secure Coding for NodeJSSecure Coding for NodeJS
Secure Coding for NodeJS
 
Vb.net (loop structure)
Vb.net (loop structure)Vb.net (loop structure)
Vb.net (loop structure)
 
Kerberos
KerberosKerberos
Kerberos
 
Basic i/o & file handling in java
Basic i/o & file handling in javaBasic i/o & file handling in java
Basic i/o & file handling in java
 
Hash Function
Hash FunctionHash Function
Hash Function
 
Secure Socket Layer
Secure Socket LayerSecure Socket Layer
Secure Socket Layer
 
Introduction to Cryptography
Introduction to CryptographyIntroduction to Cryptography
Introduction to Cryptography
 
DEC algorithm
DEC algorithmDEC algorithm
DEC algorithm
 
Graphics programming in Java
Graphics programming in JavaGraphics programming in Java
Graphics programming in Java
 
Switch function
Switch functionSwitch function
Switch function
 
Information and network security 29 international data encryption algorithm
Information and network security 29 international data encryption algorithmInformation and network security 29 international data encryption algorithm
Information and network security 29 international data encryption algorithm
 
Data Encryption and Decryption using Hill Cipher
Data Encryption and Decryption using Hill CipherData Encryption and Decryption using Hill Cipher
Data Encryption and Decryption using Hill Cipher
 
An Introduction to Kerberos
An Introduction to KerberosAn Introduction to Kerberos
An Introduction to Kerberos
 
Secret sharing schemes
Secret sharing schemesSecret sharing schemes
Secret sharing schemes
 
ESP.ppt
ESP.pptESP.ppt
ESP.ppt
 
IT6712 lab manual
IT6712 lab manualIT6712 lab manual
IT6712 lab manual
 
IP Sec - Basic Concepts
IP Sec - Basic ConceptsIP Sec - Basic Concepts
IP Sec - Basic Concepts
 
Elliptic Curve Cryptography
Elliptic Curve CryptographyElliptic Curve Cryptography
Elliptic Curve Cryptography
 

Viewers also liked (20)

One Dimentional Array
One Dimentional ArrayOne Dimentional Array
One Dimentional Array
 
Array in c language
Array in c languageArray in c language
Array in c language
 
Selection Control Structures
Selection Control StructuresSelection Control Structures
Selection Control Structures
 
9 lan
9 lan9 lan
9 lan
 
Ch3 selection
Ch3 selectionCh3 selection
Ch3 selection
 
Ch8 file processing
Ch8 file processingCh8 file processing
Ch8 file processing
 
Ch3 repetition
Ch3 repetitionCh3 repetition
Ch3 repetition
 
Ch6 pointers (latest)
Ch6 pointers (latest)Ch6 pointers (latest)
Ch6 pointers (latest)
 
Question bank
Question bankQuestion bank
Question bank
 
Ch4 functions
Ch4 functionsCh4 functions
Ch4 functions
 
10 high speedla-ns
10 high speedla-ns10 high speedla-ns
10 high speedla-ns
 
BMS 5th SEM Question Paper:-Logistic & SCM
BMS 5th SEM Question Paper:-Logistic & SCMBMS 5th SEM Question Paper:-Logistic & SCM
BMS 5th SEM Question Paper:-Logistic & SCM
 
6 arrays injava
6 arrays injava6 arrays injava
6 arrays injava
 
Java question bank
 Java question bank Java question bank
Java question bank
 
Ch7 structures
Ch7 structuresCh7 structures
Ch7 structures
 
Ch2 introduction to c
Ch2 introduction to cCh2 introduction to c
Ch2 introduction to c
 
13 atm
13 atm13 atm
13 atm
 
6 data linkcontrol
6  data linkcontrol6  data linkcontrol
6 data linkcontrol
 
Ch1 principles of software development
Ch1 principles of software developmentCh1 principles of software development
Ch1 principles of software development
 
8 spread spectrum
8 spread spectrum8 spread spectrum
8 spread spectrum
 

Similar to Ch5 array nota

Lec2&3 data structure
Lec2&3 data structureLec2&3 data structure
Lec2&3 data structure
Saad Gabr
 
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
 

Similar to Ch5 array nota (20)

Fp201 unit4
Fp201 unit4Fp201 unit4
Fp201 unit4
 
Unit4 Slides
Unit4 SlidesUnit4 Slides
Unit4 Slides
 
Arrays in Java
Arrays in JavaArrays in Java
Arrays in Java
 
Unit 3
Unit 3 Unit 3
Unit 3
 
Unit 3
Unit 3 Unit 3
Unit 3
 
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
 
Lec2&3 data structure
Lec2&3 data structureLec2&3 data structure
Lec2&3 data structure
 
Lec2
Lec2Lec2
Lec2
 
Lec2&3_DataStructure
Lec2&3_DataStructureLec2&3_DataStructure
Lec2&3_DataStructure
 
Java part 2
Java part  2Java part  2
Java part 2
 
Intake 38 3
Intake 38 3Intake 38 3
Intake 38 3
 
Lecture_01.2.pptx
Lecture_01.2.pptxLecture_01.2.pptx
Lecture_01.2.pptx
 
Array
ArrayArray
Array
 
Arrays
ArraysArrays
Arrays
 
2D Array
2D Array 2D Array
2D Array
 
Arrays
ArraysArrays
Arrays
 
Arrays and function basic c programming notes
Arrays and function basic c programming notesArrays and function basic c programming notes
Arrays and function basic c programming notes
 
Arrays & Strings
Arrays & StringsArrays & Strings
Arrays & Strings
 
07+08slide.pptx
07+08slide.pptx07+08slide.pptx
07+08slide.pptx
 
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
 

More from Hattori Sidek

More from Hattori Sidek (17)

Chapter 4 frequency modulation
Chapter 4 frequency modulationChapter 4 frequency modulation
Chapter 4 frequency modulation
 
Chapter 3 am receivers
Chapter 3 am receiversChapter 3 am receivers
Chapter 3 am receivers
 
12 wireless la-ns
12 wireless la-ns12 wireless la-ns
12 wireless la-ns
 
11 circuit-packet
11 circuit-packet11 circuit-packet
11 circuit-packet
 
7 multiplexing
7 multiplexing7 multiplexing
7 multiplexing
 
5 digital datacomm
5 digital datacomm5 digital datacomm
5 digital datacomm
 
4 signal encodingtechniques
4 signal encodingtechniques4 signal encodingtechniques
4 signal encodingtechniques
 
3. transmission media
3. transmission media3. transmission media
3. transmission media
 
2[1].1 data transmission
2[1].1 data transmission2[1].1 data transmission
2[1].1 data transmission
 
14 congestionin datanetworks
14 congestionin datanetworks14 congestionin datanetworks
14 congestionin datanetworks
 
01 pengenalan
01 pengenalan01 pengenalan
01 pengenalan
 
01 berkenalan
01 berkenalan01 berkenalan
01 berkenalan
 
Chapter 2 amplitude_modulation
Chapter 2 amplitude_modulationChapter 2 amplitude_modulation
Chapter 2 amplitude_modulation
 
Comm introduction
Comm introductionComm introduction
Comm introduction
 
Chapter5 dek3133
Chapter5 dek3133Chapter5 dek3133
Chapter5 dek3133
 
Chapter 6 edit
Chapter 6 editChapter 6 edit
Chapter 6 edit
 
Chapter 6 dc motor speed control
Chapter 6 dc motor speed controlChapter 6 dc motor speed control
Chapter 6 dc motor speed control
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 

Ch5 array nota

  • 1. Chapter 5 : ARRAY 5.1 Introduction 5.2 One Dimensional Array 5.2.1 Declaring Array 5.2.2 Array Initialization 5.2.3 Array Referencing 5.2.4 Array to Function 5.3 Two Dimensional Array 5.3.1 Two Dimensional Array Declaration 5.3.2 Two Dimensional Array Initialization 5.3.3 Two Dimensional Array Referencing
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28. 5.3.3 Two Dimensional Array Referencing (cont…) Example Program 5.8 #include<stdio.h> void main( ) { int exam_score[3][4]={{70,80,90,72},{82,92,71,81},{91,67,78,98}}; for(int row=0; row<3; row++) { for(int column=0; column<4; column++){ exam_score[row][column]= exam_score[row][column]+1; printf(&quot;[%d][%d] = %d&quot;,row,column,exam_score[row][column]); } } } //Program Output [0][0] = 71 [0][1] = 81 [0][2] = 91 [0][3] = 73 [1][0] = 83 [1][1] = 93 [1][2] = 72 [1][3] = 82 [2][0] = 92 [2][1] = 68 [2][2] = 79 [2][3] = 99