SlideShare a Scribd company logo
3
Most read
8
Most read
9
Most read
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

PPTX
Array in c++
Mahesha Mano
 
PPTX
Presentation on array
topu93
 
PPTX
Array ppt
Kaushal Mehta
 
PPT
C++ Arrays
أحمد محمد
 
PPTX
Array in c programming
Mazharul Islam
 
PDF
Software engineering a practitioners approach 8th edition pressman solutions ...
Drusilla918
 
DOC
A sample on industrial visit report for MBA students by Bilal Khan
Bilal Khan
 
PDF
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
Balwant Gorad
 
Array in c++
Mahesha Mano
 
Presentation on array
topu93
 
Array ppt
Kaushal Mehta
 
C++ Arrays
أحمد محمد
 
Array in c programming
Mazharul Islam
 
Software engineering a practitioners approach 8th edition pressman solutions ...
Drusilla918
 
A sample on industrial visit report for MBA students by Bilal Khan
Bilal Khan
 
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
Balwant Gorad
 

What's hot (20)

PPTX
Arrays In C++
Awais Alam
 
PPTX
Programming in c Arrays
janani thirupathi
 
PPTX
Arrays
Trupti Agrawal
 
PPT
Arrays
archikabhatia
 
PPTX
stack & queue
manju rani
 
PPT
One Dimensional Array
dincyjain
 
PPT
structure and union
student
 
PPT
Array in c
Ravi Gelani
 
PPTX
Sparse matrix
dincyjain
 
PPT
Arrays
SARITHA REDDY
 
PDF
sparse matrix in data structure
MAHALAKSHMI P
 
PPTX
Sparse matrix and its representation data structure
Vardhil Patel
 
PPTX
Recursion in Data Structure
khudabux1998
 
PPTX
arrays in c
vidhi mehta
 
PPTX
Arrays 1D and 2D , and multi dimensional
Appili Vamsi Krishna
 
PPTX
Arrays in c
Jeeva Nanthini
 
PPT
Binary Search
kunj desai
 
PPT
Data structure
viswanathV8
 
PPTX
Data structure & its types
Rameesha Sadaqat
 
Arrays In C++
Awais Alam
 
Programming in c Arrays
janani thirupathi
 
stack & queue
manju rani
 
One Dimensional Array
dincyjain
 
structure and union
student
 
Array in c
Ravi Gelani
 
Sparse matrix
dincyjain
 
sparse matrix in data structure
MAHALAKSHMI P
 
Sparse matrix and its representation data structure
Vardhil Patel
 
Recursion in Data Structure
khudabux1998
 
arrays in c
vidhi mehta
 
Arrays 1D and 2D , and multi dimensional
Appili Vamsi Krishna
 
Arrays in c
Jeeva Nanthini
 
Binary Search
kunj desai
 
Data structure
viswanathV8
 
Data structure & its types
Rameesha Sadaqat
 
Ad

Viewers also liked (20)

PDF
C++ ARRAY WITH EXAMPLES
Farhan Ab Rahman
 
PPTX
Array in c language
home
 
PPTX
2- Dimensional Arrays
Education Front
 
PPTX
C++ programming (Array)
طارق بالحارث
 
PPTX
Array in C
Kamal Acharya
 
PPT
02 c++ Array Pointer
Tareq Hasan
 
PPT
Array Presentation (EngineerBaBu.com)
EngineerBabu
 
PPTX
Concept Of C++ Data Types
k v
 
PPT
Selection Control Structures
PRN USM
 
PPTX
One Dimentional Array
Sonya Akter Rupa
 
PDF
Php, mysq lpart5(mysql)
Subhasis Nayak
 
PDF
Array in Java
Ali shah
 
PPTX
Classes and objects till 16 aug
shashank12march
 
PDF
Pointer in c++ part3
Subhasis Nayak
 
PPTX
C++ classes
Aayush Patel
 
PDF
Big Data Visualization With ParaView
Swiss Big Data User Group
 
PDF
Pointer in c++ part2
Subhasis Nayak
 
PPT
Two dimensional array
Rajendran
 
PPT
Ch5 array nota
Hattori Sidek
 
PPTX
C++ lecture 04
HNDE Labuduwa Galle
 
C++ ARRAY WITH EXAMPLES
Farhan Ab Rahman
 
Array in c language
home
 
2- Dimensional Arrays
Education Front
 
C++ programming (Array)
طارق بالحارث
 
Array in C
Kamal Acharya
 
02 c++ Array Pointer
Tareq Hasan
 
Array Presentation (EngineerBaBu.com)
EngineerBabu
 
Concept Of C++ Data Types
k v
 
Selection Control Structures
PRN USM
 
One Dimentional Array
Sonya Akter Rupa
 
Php, mysq lpart5(mysql)
Subhasis Nayak
 
Array in Java
Ali shah
 
Classes and objects till 16 aug
shashank12march
 
Pointer in c++ part3
Subhasis Nayak
 
C++ classes
Aayush Patel
 
Big Data Visualization With ParaView
Swiss Big Data User Group
 
Pointer in c++ part2
Subhasis Nayak
 
Two dimensional array
Rajendran
 
Ch5 array nota
Hattori Sidek
 
C++ lecture 04
HNDE Labuduwa Galle
 
Ad

Similar to Introduction to Array ppt (20)

PPTX
arraytypes of array and pointer string in c++.pptx
harinipradeep15
 
PPTX
Arrays In C Programming Explained
Simplilearn
 
PDF
Chapter 4 (Part I) - Array and Strings.pdf
KirubelWondwoson1
 
PPTX
ARRAY
ayush raj
 
PPT
7.basic array
Mir Riyanul Islam
 
PPT
Arrays
Manthan Dhavne
 
PDF
Arrays
ViniVini48
 
PPTX
Arrays
Chirag vasava
 
PPTX
BHARGAVIARRAY.PPT.pptx
Sasideepa
 
PPTX
Arrays in Data Structure and Algorithm
KristinaBorooah
 
PPTX
2D Array
Ehatsham Riaz
 
PPTX
Array
Allah Ditta
 
PDF
array-191103180006.pdf
HEMAHEMS5
 
PPT
Algo>Arrays
Ain-ul-Moiz Khawaja
 
PPTX
Array Introduction One-dimensional array Multidimensional array
imtiazalijoono
 
PDF
Introduction to Arrays in C
Thesis Scientist Private Limited
 
PPTX
Arrays accessing using for loops
sangrampatil81
 
PDF
Java part 2
ACCESS Health Digital
 
arraytypes of array and pointer string in c++.pptx
harinipradeep15
 
Arrays In C Programming Explained
Simplilearn
 
Chapter 4 (Part I) - Array and Strings.pdf
KirubelWondwoson1
 
ARRAY
ayush raj
 
7.basic array
Mir Riyanul Islam
 
Arrays
ViniVini48
 
BHARGAVIARRAY.PPT.pptx
Sasideepa
 
Arrays in Data Structure and Algorithm
KristinaBorooah
 
2D Array
Ehatsham Riaz
 
array-191103180006.pdf
HEMAHEMS5
 
Algo>Arrays
Ain-ul-Moiz Khawaja
 
Array Introduction One-dimensional array Multidimensional array
imtiazalijoono
 
Introduction to Arrays in C
Thesis Scientist Private Limited
 
Arrays accessing using for loops
sangrampatil81
 

Recently uploaded (20)

PDF
Arihant Class 10 All in One Maths full pdf
sajal kumar
 
PPTX
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
PPTX
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
PDF
7.Particulate-Nature-of-Matter.ppt/8th class science curiosity/by k sandeep s...
Sandeep Swamy
 
PPTX
Congenital Hypothyroidism pptx
AneetaSharma15
 
PDF
Virat Kohli- the Pride of Indian cricket
kushpar147
 
PDF
1.Natural-Resources-and-Their-Use.ppt pdf /8th class social science Exploring...
Sandeep Swamy
 
PDF
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
PPTX
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
PPTX
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
PPT
Python Programming Unit II Control Statements.ppt
CUO VEERANAN VEERANAN
 
PPTX
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
PPTX
ACUTE NASOPHARYNGITIS. pptx
AneetaSharma15
 
PPTX
PREVENTIVE PEDIATRIC. pptx
AneetaSharma15
 
PDF
Exploring-Forces 5.pdf/8th science curiosity/by sandeep swamy notes/ppt
Sandeep Swamy
 
PPTX
Five Point Someone – Chetan Bhagat | Book Summary & Analysis by Bhupesh Kushwaha
Bhupesh Kushwaha
 
PPTX
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
PDF
Phylum Arthropoda: Characteristics and Classification, Entomology Lecture
Miraj Khan
 
PPTX
PPTs-The Rise of Empiresghhhhhhhh (1).pptx
academysrusti114
 
PDF
5.EXPLORING-FORCES-Detailed-Notes.pdf/8TH CLASS SCIENCE CURIOSITY
Sandeep Swamy
 
Arihant Class 10 All in One Maths full pdf
sajal kumar
 
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
7.Particulate-Nature-of-Matter.ppt/8th class science curiosity/by k sandeep s...
Sandeep Swamy
 
Congenital Hypothyroidism pptx
AneetaSharma15
 
Virat Kohli- the Pride of Indian cricket
kushpar147
 
1.Natural-Resources-and-Their-Use.ppt pdf /8th class social science Exploring...
Sandeep Swamy
 
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
Python Programming Unit II Control Statements.ppt
CUO VEERANAN VEERANAN
 
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
ACUTE NASOPHARYNGITIS. pptx
AneetaSharma15
 
PREVENTIVE PEDIATRIC. pptx
AneetaSharma15
 
Exploring-Forces 5.pdf/8th science curiosity/by sandeep swamy notes/ppt
Sandeep Swamy
 
Five Point Someone – Chetan Bhagat | Book Summary & Analysis by Bhupesh Kushwaha
Bhupesh Kushwaha
 
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
Phylum Arthropoda: Characteristics and Classification, Entomology Lecture
Miraj Khan
 
PPTs-The Rise of Empiresghhhhhhhh (1).pptx
academysrusti114
 
5.EXPLORING-FORCES-Detailed-Notes.pdf/8TH CLASS SCIENCE CURIOSITY
Sandeep Swamy
 

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