SlideShare a Scribd company logo
1 of 7
ARRAYS
Introduction
An array is a series of elements of the same type placed in contiguous
memory locations that can be individually referenced by adding an index to a
unique identifier.
That means that, for example, five values of type int can be declared as an
array without having to declare 5 different variables (each with its own
identifier). Instead, using an array, the five int values are stored in
contiguous memory locations, and all five can be accessed using the same
identifier, with the proper index.
Subject content
By default, regular arrays of local scope (for example, those declared within a
function) are left uninitialized. This means that none of its elements are set
to any particular value; their contents are undetermined at the point the
array is declared.
But the elements in an array can be explicitly initialized to specific values
when it is declared, by enclosing those initial values in braces}{
Subject content
The number of values between braces {} shall not be greater than the number
of elements in the array. For example, in the example dwon, foo was
declared having 5 elements (as specified by the number enclosed in square
brackets, []), and the braces {} contained exactly 5 values, one for each
element. If declared with less, the remaining elements are set to their
default values (which for fundamental types, means they are filled with
zeroes(.
This statement declares an array that can be represented like this:
Subject content
At some point, we may need to pass an array to a function as a parameter. In
C++, it is not possible to pass the entire block of memory represented by an
array to a function directly as an argument. But what can be passed instead is
its address. In practice, this has almost the same effect, and it is a much
faster and more efficient operation.
To accept an array as parameter for a function, the parameters can be
declared as the array type, but with empty brackets, omitting the actual size
of the array.
Summary
An array is a collection of similar data types that are stored in different
memory location.
The array elements are stored in continuous memory locations
The declaration and initialization of one, two, and multi-dimensional arrays
are studied in chapter with programming examples.
A common use of the one-dimensional array stretcher is to create character
strings. A character string is an array of type char which is terminated by the
nu11 terminator character ‘0’.
http://www.cplusplus.com/doc/tutorial/arrays/

More Related Content

What's hot (20)

2 arrays
2   arrays2   arrays
2 arrays
 
PPt. on An _Array in C
PPt. on An _Array in CPPt. on An _Array in C
PPt. on An _Array in C
 
C++ programming (Array)
C++ programming (Array)C++ programming (Array)
C++ programming (Array)
 
Relational Database Management System
Relational Database Management SystemRelational Database Management System
Relational Database Management System
 
Hash Tables in data Structure
Hash Tables in data StructureHash Tables in data Structure
Hash Tables in data Structure
 
Computer programming 2 Lesson 5
Computer programming 2  Lesson 5Computer programming 2  Lesson 5
Computer programming 2 Lesson 5
 
Arrays in c language
Arrays in c languageArrays in c language
Arrays in c language
 
haskell_fp1
haskell_fp1haskell_fp1
haskell_fp1
 
List
ListList
List
 
PROLOG: Matching And Proof Search In Prolog
PROLOG: Matching And Proof Search In PrologPROLOG: Matching And Proof Search In Prolog
PROLOG: Matching And Proof Search In Prolog
 
Pointers in c v5 12102017 1
Pointers in c v5 12102017 1Pointers in c v5 12102017 1
Pointers in c v5 12102017 1
 
08 Hash Tables
08 Hash Tables08 Hash Tables
08 Hash Tables
 
Introduction to Data Structure : Pointer
Introduction to Data Structure : PointerIntroduction to Data Structure : Pointer
Introduction to Data Structure : Pointer
 
Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive
 
C++ arrays part1
C++ arrays part1C++ arrays part1
C++ arrays part1
 
Data Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer ScienceData Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer Science
 
Arrays
ArraysArrays
Arrays
 
Arrays, continued
Arrays, continuedArrays, continued
Arrays, continued
 
Hash join
Hash joinHash join
Hash join
 
linear probing
linear probinglinear probing
linear probing
 

Viewers also liked

Extending UML for Agents
Extending UML for AgentsExtending UML for Agents
Extending UML for AgentsMohamed Elagnaf
 
Information management for Decision making and information sharing in disaste...
Information management for Decision making and information sharing in disaste...Information management for Decision making and information sharing in disaste...
Information management for Decision making and information sharing in disaste...Dr. Mohamed Gabr
 
نظم المعلومات في المؤسسات التعليمية
نظم المعلومات في المؤسسات التعليميةنظم المعلومات في المؤسسات التعليمية
نظم المعلومات في المؤسسات التعليميةNadia BENABDI
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language ProcessingMohamed Elagnaf
 
Random 111018004952-phpapp02
Random 111018004952-phpapp02Random 111018004952-phpapp02
Random 111018004952-phpapp02algaffal
 
تعريف نظام التشغيل وكيفية عمله
تعريف نظام التشغيل وكيفية عملهتعريف نظام التشغيل وكيفية عمله
تعريف نظام التشغيل وكيفية عملهAhmad Abdelbaqy
 
محاضرة 3 نظام التشغيل
محاضرة 3 نظام التشغيلمحاضرة 3 نظام التشغيل
محاضرة 3 نظام التشغيلzakaria_alathari
 
Random 111018004952-phpapp02-161130004551
Random 111018004952-phpapp02-161130004551Random 111018004952-phpapp02-161130004551
Random 111018004952-phpapp02-161130004551noor basher
 
الوحدة الخامسة - قاعدة البيانات وادارتها
الوحدة الخامسة - قاعدة البيانات وادارتهاالوحدة الخامسة - قاعدة البيانات وادارتها
الوحدة الخامسة - قاعدة البيانات وادارتهاAmin Abu Hammad
 
ادارة الاجتماعات للدكتور الفقي
ادارة الاجتماعات للدكتور الفقيادارة الاجتماعات للدكتور الفقي
ادارة الاجتماعات للدكتور الفقيHamad Al-Qahtani
 
الوحدة الثامنة - قاعدة البيانات وادارتها
الوحدة الثامنة - قاعدة البيانات وادارتهاالوحدة الثامنة - قاعدة البيانات وادارتها
الوحدة الثامنة - قاعدة البيانات وادارتهاAmin Abu Hammad
 
محضر اجتماع
محضر اجتماعمحضر اجتماع
محضر اجتماعSadeem Rashid
 
الوحدة السابعة - قاعدة البيانات وادارتها
الوحدة السابعة - قاعدة البيانات وادارتهاالوحدة السابعة - قاعدة البيانات وادارتها
الوحدة السابعة - قاعدة البيانات وادارتهاAmin Abu Hammad
 
نموذج اجتماع وأجندة - Meeting template
نموذج اجتماع وأجندة - Meeting templateنموذج اجتماع وأجندة - Meeting template
نموذج اجتماع وأجندة - Meeting templateDr Ghaiath Hussein
 
دليل المدرب لبرنامج إدارة الاجتماعات
دليل المدرب لبرنامج إدارة الاجتماعاتدليل المدرب لبرنامج إدارة الاجتماعات
دليل المدرب لبرنامج إدارة الاجتماعاتtanmya-eg
 
سلسلة بناء وتطوير القدرات إعداد وإدارة الاجتماعات
سلسلة بناء وتطوير القدرات إعداد وإدارة الاجتماعاتسلسلة بناء وتطوير القدرات إعداد وإدارة الاجتماعات
سلسلة بناء وتطوير القدرات إعداد وإدارة الاجتماعاتDr Ghaiath Hussein
 

Viewers also liked (20)

Oca sql
Oca sqlOca sql
Oca sql
 
Info
InfoInfo
Info
 
Extending UML for Agents
Extending UML for AgentsExtending UML for Agents
Extending UML for Agents
 
Information management for Decision making and information sharing in disaste...
Information management for Decision making and information sharing in disaste...Information management for Decision making and information sharing in disaste...
Information management for Decision making and information sharing in disaste...
 
نظم المعلومات في المؤسسات التعليمية
نظم المعلومات في المؤسسات التعليميةنظم المعلومات في المؤسسات التعليمية
نظم المعلومات في المؤسسات التعليمية
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language Processing
 
ERDigram
ERDigramERDigram
ERDigram
 
نظام التشغيل
نظام التشغيلنظام التشغيل
نظام التشغيل
 
Random 111018004952-phpapp02
Random 111018004952-phpapp02Random 111018004952-phpapp02
Random 111018004952-phpapp02
 
تعريف نظام التشغيل وكيفية عمله
تعريف نظام التشغيل وكيفية عملهتعريف نظام التشغيل وكيفية عمله
تعريف نظام التشغيل وكيفية عمله
 
محاضرة 3 نظام التشغيل
محاضرة 3 نظام التشغيلمحاضرة 3 نظام التشغيل
محاضرة 3 نظام التشغيل
 
Random 111018004952-phpapp02-161130004551
Random 111018004952-phpapp02-161130004551Random 111018004952-phpapp02-161130004551
Random 111018004952-phpapp02-161130004551
 
الوحدة الخامسة - قاعدة البيانات وادارتها
الوحدة الخامسة - قاعدة البيانات وادارتهاالوحدة الخامسة - قاعدة البيانات وادارتها
الوحدة الخامسة - قاعدة البيانات وادارتها
 
ادارة الاجتماعات للدكتور الفقي
ادارة الاجتماعات للدكتور الفقيادارة الاجتماعات للدكتور الفقي
ادارة الاجتماعات للدكتور الفقي
 
الوحدة الثامنة - قاعدة البيانات وادارتها
الوحدة الثامنة - قاعدة البيانات وادارتهاالوحدة الثامنة - قاعدة البيانات وادارتها
الوحدة الثامنة - قاعدة البيانات وادارتها
 
محضر اجتماع
محضر اجتماعمحضر اجتماع
محضر اجتماع
 
الوحدة السابعة - قاعدة البيانات وادارتها
الوحدة السابعة - قاعدة البيانات وادارتهاالوحدة السابعة - قاعدة البيانات وادارتها
الوحدة السابعة - قاعدة البيانات وادارتها
 
نموذج اجتماع وأجندة - Meeting template
نموذج اجتماع وأجندة - Meeting templateنموذج اجتماع وأجندة - Meeting template
نموذج اجتماع وأجندة - Meeting template
 
دليل المدرب لبرنامج إدارة الاجتماعات
دليل المدرب لبرنامج إدارة الاجتماعاتدليل المدرب لبرنامج إدارة الاجتماعات
دليل المدرب لبرنامج إدارة الاجتماعات
 
سلسلة بناء وتطوير القدرات إعداد وإدارة الاجتماعات
سلسلة بناء وتطوير القدرات إعداد وإدارة الاجتماعاتسلسلة بناء وتطوير القدرات إعداد وإدارة الاجتماعات
سلسلة بناء وتطوير القدرات إعداد وإدارة الاجتماعات
 

Similar to نموذج لعمل المشروع المطلوب لمقرر برمجة الحاسب

Module 4- Arrays and Strings
Module 4- Arrays and StringsModule 4- Arrays and Strings
Module 4- Arrays and Stringsnikshaikh786
 
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 .pdfaroraopticals15
 
Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm KristinaBorooah
 
COMPLEX AND USER DEFINED TYPESPlease note that the material on t.docx
COMPLEX AND USER DEFINED TYPESPlease note that the material on t.docxCOMPLEX AND USER DEFINED TYPESPlease note that the material on t.docx
COMPLEX AND USER DEFINED TYPESPlease note that the material on t.docxdonnajames55
 
Arrays in programming
Arrays in programmingArrays in programming
Arrays in programmingTaseerRao
 
ppt on arrays in c programming language.pptx
ppt on arrays in c programming language.pptxppt on arrays in c programming language.pptx
ppt on arrays in c programming language.pptxAmanRai352102
 
6 data types
6 data types6 data types
6 data typesjigeno
 
Strings Arrays
Strings ArraysStrings Arrays
Strings Arraysphanleson
 

Similar to نموذج لعمل المشروع المطلوب لمقرر برمجة الحاسب (20)

Arrays in c++
Arrays in c++Arrays in c++
Arrays in c++
 
Module 4- Arrays and Strings
Module 4- Arrays and StringsModule 4- Arrays and Strings
Module 4- Arrays and Strings
 
unit 2.pptx
unit 2.pptxunit 2.pptx
unit 2.pptx
 
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
 
Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm
 
Unit 2
Unit 2Unit 2
Unit 2
 
Python ppt_118.pptx
Python ppt_118.pptxPython ppt_118.pptx
Python ppt_118.pptx
 
Chapter-Five.pptx
Chapter-Five.pptxChapter-Five.pptx
Chapter-Five.pptx
 
Module7
Module7Module7
Module7
 
COMPLEX AND USER DEFINED TYPESPlease note that the material on t.docx
COMPLEX AND USER DEFINED TYPESPlease note that the material on t.docxCOMPLEX AND USER DEFINED TYPESPlease note that the material on t.docx
COMPLEX AND USER DEFINED TYPESPlease note that the material on t.docx
 
Arrays in programming
Arrays in programmingArrays in programming
Arrays in programming
 
ppt on arrays in c programming language.pptx
ppt on arrays in c programming language.pptxppt on arrays in c programming language.pptx
ppt on arrays in c programming language.pptx
 
Arrays and Strings
Arrays and Strings Arrays and Strings
Arrays and Strings
 
java.pdf
java.pdfjava.pdf
java.pdf
 
DEMO.ppt
DEMO.pptDEMO.ppt
DEMO.ppt
 
6 data types
6 data types6 data types
6 data types
 
Arrays
ArraysArrays
Arrays
 
Do not delete!
Do not delete!Do not delete!
Do not delete!
 
Strings Arrays
Strings ArraysStrings Arrays
Strings Arrays
 
Lecture 2a arrays
Lecture 2a arraysLecture 2a arrays
Lecture 2a arrays
 

Recently uploaded

Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
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 13Steve Thomason
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
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 communicationnomboosow
 
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. Mahajanpragatimahajan3
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
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
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
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 ...EduSkills OECD
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 

Recently uploaded (20)

Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
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
 
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"
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
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
 
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
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
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...
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
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 ...
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 

نموذج لعمل المشروع المطلوب لمقرر برمجة الحاسب

  • 2. Introduction An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a unique identifier. That means that, for example, five values of type int can be declared as an array without having to declare 5 different variables (each with its own identifier). Instead, using an array, the five int values are stored in contiguous memory locations, and all five can be accessed using the same identifier, with the proper index.
  • 3. Subject content By default, regular arrays of local scope (for example, those declared within a function) are left uninitialized. This means that none of its elements are set to any particular value; their contents are undetermined at the point the array is declared. But the elements in an array can be explicitly initialized to specific values when it is declared, by enclosing those initial values in braces}{
  • 4. Subject content The number of values between braces {} shall not be greater than the number of elements in the array. For example, in the example dwon, foo was declared having 5 elements (as specified by the number enclosed in square brackets, []), and the braces {} contained exactly 5 values, one for each element. If declared with less, the remaining elements are set to their default values (which for fundamental types, means they are filled with zeroes(. This statement declares an array that can be represented like this:
  • 5. Subject content At some point, we may need to pass an array to a function as a parameter. In C++, it is not possible to pass the entire block of memory represented by an array to a function directly as an argument. But what can be passed instead is its address. In practice, this has almost the same effect, and it is a much faster and more efficient operation. To accept an array as parameter for a function, the parameters can be declared as the array type, but with empty brackets, omitting the actual size of the array.
  • 6. Summary An array is a collection of similar data types that are stored in different memory location. The array elements are stored in continuous memory locations The declaration and initialization of one, two, and multi-dimensional arrays are studied in chapter with programming examples. A common use of the one-dimensional array stretcher is to create character strings. A character string is an array of type char which is terminated by the nu11 terminator character ‘0’.