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

12 symmetric key cryptography
12   symmetric key cryptography12   symmetric key cryptography
12 symmetric key cryptography
drewz lin
 
Osi model vs TCP/IP
Osi model vs TCP/IPOsi model vs TCP/IP
Osi model vs TCP/IP
Mannu Khani
 

What's hot (20)

Stacks in c++
Stacks in c++Stacks in c++
Stacks in c++
 
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMINGChapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
 
Computer Organization And Architecture lab manual
Computer Organization And Architecture lab manualComputer Organization And Architecture lab manual
Computer Organization And Architecture lab manual
 
Firewall ppt
Firewall pptFirewall ppt
Firewall ppt
 
Memory mapped I/O and Isolated I/O
Memory mapped I/O and Isolated I/OMemory mapped I/O and Isolated I/O
Memory mapped I/O and Isolated I/O
 
Symmetric encryption and message confidentiality
Symmetric encryption and message confidentialitySymmetric encryption and message confidentiality
Symmetric encryption and message confidentiality
 
CRYPTOGRAPHY & NETWORK SECURITY - unit 1
CRYPTOGRAPHY & NETWORK SECURITY -  unit 1CRYPTOGRAPHY & NETWORK SECURITY -  unit 1
CRYPTOGRAPHY & NETWORK SECURITY - unit 1
 
Ip addressing
Ip addressingIp addressing
Ip addressing
 
Input & Output
Input & OutputInput & Output
Input & Output
 
12 symmetric key cryptography
12   symmetric key cryptography12   symmetric key cryptography
12 symmetric key cryptography
 
Array in C
Array in CArray in C
Array in C
 
Pointers in C Programming
Pointers in C ProgrammingPointers in C Programming
Pointers in C Programming
 
Getters_And_Setters.pptx
Getters_And_Setters.pptxGetters_And_Setters.pptx
Getters_And_Setters.pptx
 
Strings in C
Strings in CStrings in C
Strings in C
 
Lecture #5 Data Communication and Network
Lecture #5 Data Communication and NetworkLecture #5 Data Communication and Network
Lecture #5 Data Communication and Network
 
string in C
string in Cstring in C
string in C
 
Abstraction in c++ and Real Life Example of Abstraction in C++
Abstraction in c++ and Real Life Example of Abstraction in C++Abstraction in c++ and Real Life Example of Abstraction in C++
Abstraction in c++ and Real Life Example of Abstraction in C++
 
Osi model vs TCP/IP
Osi model vs TCP/IPOsi model vs TCP/IP
Osi model vs TCP/IP
 
Input output module
Input output moduleInput output module
Input output module
 
Structure of switches
Structure of switchesStructure of switches
Structure of switches
 

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

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 

Recently uploaded (20)

APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 

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