SlideShare a Scribd company logo
ARRAY
IN
C++
 Introduction to Array
 Need of Array
 Types of Array
 Single dimensional
 Two dimensional
 Multi dimensional
 Array initialization
 Unsized Array initialization
 String as an array
Contents
Array is a collection of variables that can hold
value of same type and reference by common
name .Its is a derived data Structure
Array are always stored in a continuous memory locations.
An Array either be a integer ,character, or float base type
(Data type of array) .
Array indexing is always start from zero and highest address
corresponds to last element
Introduction
Num [0]
Num[1]
Num[2]
Num[3]
Num[4]
Num[5]
Int num [6]
Base type of
arrray
Name
of array
Size of
array
Continuous
memory
allocation of
array
To store processed large number of variables of same
data type and reference/name
Easy understanding of program
Example: Marks
0
1
2
3
4
5
Need ofArrray
One dimensional
Two dimensional
Multi dimensional
Types ofArray
A one dimensional array is one in which one
subscript /indices specification is needed to
specify a particular element of array
Declaration :
Data_type array_name [size of array ];
Eg:
Int num[10];
1-D Array
num[0] num[1] num[2] num[3] num[4] num[5] num[6] num[7] num[8] num[9]
2000 2002 2004 2006 2008 2010 2012 2014 2016 2018
starting Address of location
Total memory in bytes that an array is occupied :
Size of array=size of array*size of(base type)
Hear,
10*2=20
39 56 23 98 6 56 09 2 54 67
Memory representation:
A 2-d array is an array in which each element is itself
an array
i.e int num[4][3]
0 1 2
0
1
2
3
2-D Array
No of
rows
No of
columns
Num [2][1]
No of element in
2-D array =M*N
Total bytes= no of rows*no of columns*size of(base
type)
Memory reprsentation in 2-D array:
char A [2][3]
A[0][0] A[0][1] A[0][2] A[1][0] A[1][1] A[1][2]
5001 5002 5003 5004 5005 5006
size of 2-D array
An array with dimensions more than two .The
maximum limit of array is compiler dependent
Declration:
Data_type name [a][b][c][d][e][f]…….[n];
Array of 3 or more dimensional are not often
use because of huge memory requirement
and complexity involved
Multi dimensionalarray
C++ provides the facility of array initialization at the time of
declaration .General form of array initialization is as:
Type array_name[size 1]…..[size N] ={vale list};
Eg:
Int days_month[12]={31,25,29,03,31,19,20,31,18,20,31,29};
Char string[6]={‘a’,’r’,’g’,’y’,’d’,’0’};
2-D array are also initialized in same way as linear array
Int cube[4][2]={ 1,3,
4,6,
9,37,
5,78
};
Arrayinitialization
C++ allowed you to skip the size of array in an array initialization
statement C++ automatically create an array big enough to hold
all the initializers present
Char S1[] =“ first string ”;
you skip the size, you must give list of initializers so that C++
can calculate the size of array
Int val []={3,5,6,2,8,9,6,4};
Int cube [] [2] ={ 1,3,
67,7,
6,87,
};
Unsizedarrayinitializations
C++ does not have a String data type ,it
impairments string as 1-D character Arrray .A
string as a character array is terminate by a
null character ‘0’
Char str 1 [11];
Char square [][]={ ‘first string’,
‘second string’,
‘third string’
};
String as array
Thank you

More Related Content

What's hot

Two dimensional arrays
Two dimensional arraysTwo dimensional arrays
Two dimensional arrays
Neeru Mittal
 
Array in c
Array in cArray in c
Array in c
Ravi Gelani
 
Programming in c Arrays
Programming in c ArraysProgramming in c Arrays
Programming in c Arrays
janani thirupathi
 
C++ Arrays
C++ ArraysC++ Arrays
C++ Arrays
أحمد محمد
 
Arrays in c
Arrays in cArrays in c
Arrays in c
vampugani
 
Arrays Basics
Arrays BasicsArrays Basics
Arrays Basics
Nikhil Pandit
 
Arrays
ArraysArrays
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
 
stack presentation
stack presentationstack presentation
Strings Functions in C Programming
Strings Functions in C ProgrammingStrings Functions in C Programming
Strings Functions in C Programming
DevoAjit Gupta
 
Basic array in c programming
Basic array in c programmingBasic array in c programming
Basic array in c programming
Sajid Hasan
 
ARRAY
ARRAYARRAY
ARRAY
ayush raj
 
Multidimensional array in C
Multidimensional array in CMultidimensional array in C
Multidimensional array in C
Smit Parikh
 
Array in c programming
Array in c programmingArray in c programming
Array in c programming
Mazharul Islam
 
Two dimensional array
Two dimensional arrayTwo dimensional array
Two dimensional array
Rajendran
 
Python tuple
Python   tuplePython   tuple
Python tuple
Mohammed Sikander
 
One Dimensional Array
One Dimensional Array One Dimensional Array
One Dimensional Array
dincyjain
 
Data types in c++
Data types in c++Data types in c++
Data types in c++
Venkata.Manish Reddy
 
sparse matrix in data structure
sparse matrix in data structuresparse matrix in data structure
sparse matrix in data structure
MAHALAKSHMI P
 

What's hot (20)

Two dimensional arrays
Two dimensional arraysTwo dimensional arrays
Two dimensional arrays
 
Array in c
Array in cArray in c
Array in c
 
Programming in c Arrays
Programming in c ArraysProgramming in c Arrays
Programming in c Arrays
 
C++ Arrays
C++ ArraysC++ Arrays
C++ Arrays
 
Arrays in c
Arrays in cArrays in c
Arrays in c
 
Arrays in Java
Arrays in JavaArrays in Java
Arrays in Java
 
Arrays Basics
Arrays BasicsArrays Basics
Arrays Basics
 
Arrays
ArraysArrays
Arrays
 
Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm
 
stack presentation
stack presentationstack presentation
stack presentation
 
Strings Functions in C Programming
Strings Functions in C ProgrammingStrings Functions in C Programming
Strings Functions in C Programming
 
Basic array in c programming
Basic array in c programmingBasic array in c programming
Basic array in c programming
 
ARRAY
ARRAYARRAY
ARRAY
 
Multidimensional array in C
Multidimensional array in CMultidimensional array in C
Multidimensional array in C
 
Array in c programming
Array in c programmingArray in c programming
Array in c programming
 
Two dimensional array
Two dimensional arrayTwo dimensional array
Two dimensional array
 
Python tuple
Python   tuplePython   tuple
Python tuple
 
One Dimensional Array
One Dimensional Array One Dimensional Array
One Dimensional Array
 
Data types in c++
Data types in c++Data types in c++
Data types in c++
 
sparse matrix in data structure
sparse matrix in data structuresparse matrix in data structure
sparse matrix in data structure
 

Viewers also liked

C++ ARRAY WITH EXAMPLES
C++ ARRAY WITH EXAMPLESC++ ARRAY WITH EXAMPLES
C++ ARRAY WITH EXAMPLES
Farhan Ab Rahman
 
Arrays
ArraysArrays
Array in c language
Array in c languageArray in c language
Array in c languagehome
 
2- Dimensional Arrays
2- Dimensional Arrays2- Dimensional Arrays
2- Dimensional Arrays
Education Front
 
C++ programming (Array)
C++ programming (Array)C++ programming (Array)
C++ programming (Array)
طارق بالحارث
 
Array in C
Array in CArray in C
Array in C
Kamal Acharya
 
02 c++ Array Pointer
02 c++ Array Pointer02 c++ Array Pointer
02 c++ Array PointerTareq Hasan
 
Array Presentation (EngineerBaBu.com)
Array Presentation (EngineerBaBu.com)Array Presentation (EngineerBaBu.com)
Array Presentation (EngineerBaBu.com)
EngineerBabu
 
Concept Of C++ Data Types
Concept Of C++ Data TypesConcept Of C++ Data Types
Concept Of C++ Data Types
k v
 
Selection Control Structures
Selection Control StructuresSelection Control Structures
Selection Control Structures
PRN USM
 
One Dimentional Array
One Dimentional ArrayOne Dimentional Array
One Dimentional Array
Sonya Akter Rupa
 
Php, mysq lpart5(mysql)
Php, mysq lpart5(mysql)Php, mysq lpart5(mysql)
Php, mysq lpart5(mysql)
Subhasis Nayak
 
Array in Java
Array in JavaArray in Java
Array in Java
Ali shah
 
Classes and objects till 16 aug
Classes and objects till 16 augClasses and objects till 16 aug
Classes and objects till 16 augshashank12march
 
Pointer in c++ part3
Pointer in c++ part3Pointer in c++ part3
Pointer in c++ part3
Subhasis Nayak
 
C++ classes
C++ classesC++ classes
C++ classes
Aayush Patel
 
Big Data Visualization With ParaView
Big Data Visualization With ParaViewBig Data Visualization With ParaView
Big Data Visualization With ParaView
Swiss Big Data User Group
 
Pointer in c++ part2
Pointer in c++ part2Pointer in c++ part2
Pointer in c++ part2
Subhasis Nayak
 
C++ lecture 04
C++ lecture 04C++ lecture 04
C++ lecture 04
HNDE Labuduwa Galle
 

Viewers also liked (20)

C++ ARRAY WITH EXAMPLES
C++ ARRAY WITH EXAMPLESC++ ARRAY WITH EXAMPLES
C++ ARRAY WITH EXAMPLES
 
Arrays
ArraysArrays
Arrays
 
Array in c language
Array in c languageArray in c language
Array in c language
 
2- Dimensional Arrays
2- Dimensional Arrays2- Dimensional Arrays
2- Dimensional Arrays
 
C++ programming (Array)
C++ programming (Array)C++ programming (Array)
C++ programming (Array)
 
Array in C
Array in CArray in C
Array in C
 
02 c++ Array Pointer
02 c++ Array Pointer02 c++ Array Pointer
02 c++ Array Pointer
 
Array Presentation (EngineerBaBu.com)
Array Presentation (EngineerBaBu.com)Array Presentation (EngineerBaBu.com)
Array Presentation (EngineerBaBu.com)
 
Concept Of C++ Data Types
Concept Of C++ Data TypesConcept Of C++ Data Types
Concept Of C++ Data Types
 
Selection Control Structures
Selection Control StructuresSelection Control Structures
Selection Control Structures
 
One Dimentional Array
One Dimentional ArrayOne Dimentional Array
One Dimentional Array
 
Php, mysq lpart5(mysql)
Php, mysq lpart5(mysql)Php, mysq lpart5(mysql)
Php, mysq lpart5(mysql)
 
Array in Java
Array in JavaArray in Java
Array in Java
 
Classes and objects till 16 aug
Classes and objects till 16 augClasses and objects till 16 aug
Classes and objects till 16 aug
 
Pointer in c++ part3
Pointer in c++ part3Pointer in c++ part3
Pointer in c++ part3
 
C++ classes
C++ classesC++ classes
C++ classes
 
Big Data Visualization With ParaView
Big Data Visualization With ParaViewBig Data Visualization With ParaView
Big Data Visualization With ParaView
 
Pointer in c++ part2
Pointer in c++ part2Pointer in c++ part2
Pointer in c++ part2
 
Ch5 array nota
Ch5 array notaCh5 array nota
Ch5 array nota
 
C++ lecture 04
C++ lecture 04C++ lecture 04
C++ lecture 04
 

Similar to Introduction to Array ppt

Arrays In C Programming Explained
Arrays In C Programming ExplainedArrays In C Programming Explained
Arrays In C Programming Explained
Simplilearn
 
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
KirubelWondwoson1
 
7.basic array
7.basic array7.basic array
7.basic array
Mir Riyanul Islam
 
Arrays
ArraysArrays
Arrays
ArraysArrays
Arrays
ViniVini48
 
Arrays
ArraysArrays
BHARGAVIARRAY.PPT.pptx
BHARGAVIARRAY.PPT.pptxBHARGAVIARRAY.PPT.pptx
BHARGAVIARRAY.PPT.pptx
Sasideepa
 
Unit4 Slides
Unit4 SlidesUnit4 Slides
Unit4 Slides
Rakesh Roshan
 
Array
ArrayArray
array-191103180006.pdf
array-191103180006.pdfarray-191103180006.pdf
array-191103180006.pdf
HEMAHEMS5
 
Introduction to Arrays in C
Introduction to Arrays in CIntroduction to Arrays in C
Introduction to Arrays in C
Thesis Scientist Private Limited
 
Arrays accessing using for loops
Arrays accessing using for loopsArrays accessing using for loops
Arrays accessing using for loops
sangrampatil81
 
Functions, Strings ,Storage classes in C
 Functions, Strings ,Storage classes in C Functions, Strings ,Storage classes in C
Functions, Strings ,Storage classes in C
arshpreetkaur07
 
Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT
Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT
Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT
LATHA LAKSHMI
 
Data structure array
Data structure  arrayData structure  array
Data structure array
MajidHamidAli
 
Arrays and Strings
Arrays and Strings Arrays and Strings
Arrays and Strings
Dr.Subha Krishna
 

Similar to Introduction to Array ppt (20)

Arrays In C Programming Explained
Arrays In C Programming ExplainedArrays In C Programming Explained
Arrays In C Programming Explained
 
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
 
7.basic array
7.basic array7.basic array
7.basic array
 
Arrays
ArraysArrays
Arrays
 
Arrays
ArraysArrays
Arrays
 
Arrays
ArraysArrays
Arrays
 
BHARGAVIARRAY.PPT.pptx
BHARGAVIARRAY.PPT.pptxBHARGAVIARRAY.PPT.pptx
BHARGAVIARRAY.PPT.pptx
 
Unit4 Slides
Unit4 SlidesUnit4 Slides
Unit4 Slides
 
Array
ArrayArray
Array
 
array-191103180006.pdf
array-191103180006.pdfarray-191103180006.pdf
array-191103180006.pdf
 
Algo>Arrays
Algo>ArraysAlgo>Arrays
Algo>Arrays
 
Introduction to Arrays in C
Introduction to Arrays in CIntroduction to Arrays in C
Introduction to Arrays in C
 
Arrays accessing using for loops
Arrays accessing using for loopsArrays accessing using for loops
Arrays accessing using for loops
 
Java part 2
Java part  2Java part  2
Java part 2
 
Arrays
ArraysArrays
Arrays
 
arrays.docx
arrays.docxarrays.docx
arrays.docx
 
Functions, Strings ,Storage classes in C
 Functions, Strings ,Storage classes in C Functions, Strings ,Storage classes in C
Functions, Strings ,Storage classes in C
 
Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT
Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT
Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT
 
Data structure array
Data structure  arrayData structure  array
Data structure array
 
Arrays and Strings
Arrays and Strings Arrays and Strings
Arrays and Strings
 

Recently uploaded

BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 

Recently uploaded (20)

BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 

Introduction to Array ppt

  • 2.  Introduction to Array  Need of Array  Types of Array  Single dimensional  Two dimensional  Multi dimensional  Array initialization  Unsized Array initialization  String as an array Contents
  • 3. Array is a collection of variables that can hold value of same type and reference by common name .Its is a derived data Structure Array are always stored in a continuous memory locations. An Array either be a integer ,character, or float base type (Data type of array) . Array indexing is always start from zero and highest address corresponds to last element Introduction
  • 4. Num [0] Num[1] Num[2] Num[3] Num[4] Num[5] Int num [6] Base type of arrray Name of array Size of array Continuous memory allocation of array
  • 5. To store processed large number of variables of same data type and reference/name Easy understanding of program Example: Marks 0 1 2 3 4 5 Need ofArrray
  • 7. A one dimensional array is one in which one subscript /indices specification is needed to specify a particular element of array Declaration : Data_type array_name [size of array ]; Eg: Int num[10]; 1-D Array
  • 8. num[0] num[1] num[2] num[3] num[4] num[5] num[6] num[7] num[8] num[9] 2000 2002 2004 2006 2008 2010 2012 2014 2016 2018 starting Address of location Total memory in bytes that an array is occupied : Size of array=size of array*size of(base type) Hear, 10*2=20 39 56 23 98 6 56 09 2 54 67 Memory representation:
  • 9. A 2-d array is an array in which each element is itself an array i.e int num[4][3] 0 1 2 0 1 2 3 2-D Array No of rows No of columns Num [2][1] No of element in 2-D array =M*N
  • 10. Total bytes= no of rows*no of columns*size of(base type) Memory reprsentation in 2-D array: char A [2][3] A[0][0] A[0][1] A[0][2] A[1][0] A[1][1] A[1][2] 5001 5002 5003 5004 5005 5006 size of 2-D array
  • 11. An array with dimensions more than two .The maximum limit of array is compiler dependent Declration: Data_type name [a][b][c][d][e][f]…….[n]; Array of 3 or more dimensional are not often use because of huge memory requirement and complexity involved Multi dimensionalarray
  • 12. C++ provides the facility of array initialization at the time of declaration .General form of array initialization is as: Type array_name[size 1]…..[size N] ={vale list}; Eg: Int days_month[12]={31,25,29,03,31,19,20,31,18,20,31,29}; Char string[6]={‘a’,’r’,’g’,’y’,’d’,’0’}; 2-D array are also initialized in same way as linear array Int cube[4][2]={ 1,3, 4,6, 9,37, 5,78 }; Arrayinitialization
  • 13. C++ allowed you to skip the size of array in an array initialization statement C++ automatically create an array big enough to hold all the initializers present Char S1[] =“ first string ”; you skip the size, you must give list of initializers so that C++ can calculate the size of array Int val []={3,5,6,2,8,9,6,4}; Int cube [] [2] ={ 1,3, 67,7, 6,87, }; Unsizedarrayinitializations
  • 14. C++ does not have a String data type ,it impairments string as 1-D character Arrray .A string as a character array is terminate by a null character ‘0’ Char str 1 [11]; Char square [][]={ ‘first string’, ‘second string’, ‘third string’ }; String as array