SlideShare a Scribd company logo
Prakash Khaire
Lecturer, B V Patel Institute of BMC & IT

ARRAYS
Arrays

●It is derived data type
●Arrays are collection of data that belong to
same data type
●Arrays are collection of homogeneous data
●Array elements can be accessed by its position
in the array called as index
●Values in an array are identified using array
name with subscripts
●Also known as subscripted variable
●It is fixed-size collection of elements
●   Following are types of array
●One-dimensional Array
●Two-dimensional Array

●Multi-dimensional Array
One-dimensional Array

●A collections of variables are given one variable name
using only one subscript and such a variable is called a
single-subscripted variable or one dimensional array
●Syntax
                   data_type ArrayName[size];

    data_type : is a valid data type like int, float or char
    Arrayname : is a valid identifier
    size       : maximum number of elements that can
                be stored in array
Arrays
Array index starts with zero
The last index in an array is num – 1 where
num is the no of elements in a array
int a[9] is an array that stores 9 integers


    index         0    1     2   3   4    5   6     7     8

  elements

Memory address   100   102   104 106 108 110 112   114   116
Initilization of Array

●After declaring the array, all the elements of
array must be initialized other wise they will
contain garbage value
●At compile time
●At run time

 data_type ArrayName[size] = {list of values}

int marks[5] = {55, 63,67,78,59};
Each value is treated as an element of the array
and is stored in the memory as follows

                    marks

                      55       0

                      63       1

                      67       2


                      78       3


                      59       4
●float marks[5]={45.5,65.0,67.5.77.0,79 .0};
●char name[8]={‘P’,’r’,’a’, ’k’, ’a’, ’s’, ’h’, ’0’};


●int marks[] = {63,68,57,69,77};
●char name[] = “Prakash”;
int marks[5]={67,66};
●


     67      0


     66      1


    4646     2


    8978     3


    -545     4
Two Dimensional Array
●To store following data of 4 students


              201   202   203   204   205
    09BCA07   45    42    41    56    46
    09BCA14   46    55    70    49    56
    09BCA45   65    61    68    42    56
    09BCA115 46     38    39    45    42
Two Dimensional Array

 ●   StudentDetailsIJ
 ●   Where,
     StudentDetails represents a matrix
     I represents no. of rows
     J represents no. of columns


  It is collection of rows and columns
Two Dimensional Array

  ●   Declaration of 2D array
      type array_name[row_size][column_size];
            column0   column1   column2    column3   column4

 Row0      0,0        0,1       0,2       0,3        0,4
 Row1      1,0        1,1       1,2       1,3        1,4
 Row2      2,0        2,1       2,2       2,3        2,4
 Row3      3,0        3,1       3,2       3,3        3,4
Storage Representation

●   Similar to 1D Array, 2D array are also
    stored in contiguous memory in increasing
    memory locations.
0,0 0,1   0,2   1,0 1,1   1,2    2,0   2,1   2,2


990 992
          994   996   998 1000   1002 1004 1006
Initilization

●   int mat[3][3] = { 1,3,2,4,7,6,5,8,9};


●   int mat[3][3] = {
                     {1,3,2},
                     {4,7,6},
                     {5,8,9}
                };
●   int mat[ ][3]={
                      {1,3,2},
                      {4,7,6},
                      {5,8,9}
              };
int mat[3][3] = { {0}, {0}, {0} };



●   int mat[3][3] = {
                    {1},
                           {7,6},
                           {5}
             };


    int mat[3][3] = { {0}, {0}, {0} };
●   int mat[3][3] = { 0,0,0};

More Related Content

PPSX
C Programming : Arrays
PPTX
Array,MULTI ARRAY, IN C
PPTX
Array in c language
PPTX
Array in C
PPTX
Array in C
PPTX
Arrays in c
PPTX
Introduction to Array ppt
PPT
Arrays Class presentation
C Programming : Arrays
Array,MULTI ARRAY, IN C
Array in c language
Array in C
Array in C
Arrays in c
Introduction to Array ppt
Arrays Class presentation

What's hot (20)

PPTX
Array in c language
PPTX
Array Introduction One-dimensional array Multidimensional array
PPTX
2D Array
PPT
One dimensional 2
PPTX
Array in c
PPTX
A Presentation About Array Manipulation(Insertion & Deletion in an array)
PPTX
Array in c programming
PPTX
Array in-c
PPTX
2- Dimensional Arrays
PPT
Multidimensional array in C
PPT
Chap09
PPTX
Array in c++
PPT
Two dimensional array
PPTX
Array in c
PPTX
C++ lecture 04
PPT
Arrays in c
PDF
Arrays in C
PPTX
Arrays basics
PPTX
Basic array in c programming
Array in c language
Array Introduction One-dimensional array Multidimensional array
2D Array
One dimensional 2
Array in c
A Presentation About Array Manipulation(Insertion & Deletion in an array)
Array in c programming
Array in-c
2- Dimensional Arrays
Multidimensional array in C
Chap09
Array in c++
Two dimensional array
Array in c
C++ lecture 04
Arrays in c
Arrays in C
Arrays basics
Basic array in c programming
Ad

Viewers also liked (20)

PPT
PPT
Array Presentation (EngineerBaBu.com)
PPTX
Arrays In C++
PPTX
PDF
C++ ARRAY WITH EXAMPLES
PPT
Arrays Data Structure
PPTX
Array in c language
PPTX
C# Arrays
PPTX
Array within a class
PDF
Unit 1.2 move to cloud computing
PPT
Linked list
PPT
Java Arrays
PPT
DATA STRUCTURES
DOC
Lab exp declaring arrays)
PPSX
Lecture 3 data structures & algorithms - sorting techniques - http://techiem...
PPT
Lecture 2c stacks
PPTX
Array y Objects C#
PPT
Ms word Part 2
PPSX
Lecture 2 data structures & algorithms - sorting techniques
PDF
Array notes
Array Presentation (EngineerBaBu.com)
Arrays In C++
C++ ARRAY WITH EXAMPLES
Arrays Data Structure
Array in c language
C# Arrays
Array within a class
Unit 1.2 move to cloud computing
Linked list
Java Arrays
DATA STRUCTURES
Lab exp declaring arrays)
Lecture 3 data structures & algorithms - sorting techniques - http://techiem...
Lecture 2c stacks
Array y Objects C#
Ms word Part 2
Lecture 2 data structures & algorithms - sorting techniques
Array notes
Ad

Similar to Lecture17 arrays.ppt (20)

PPTX
arrays.pptx
PPT
Mesics lecture 8 arrays in 'c'
PPT
PPTX
Ch-11-Arrays.ppt-1.pptx eurhrbdhdbdhrhdhdh
PPTX
Basic Arrays in C Programming Language I
PPTX
UNIT-5_Array in c_part1.pptx
PDF
Arrays and library functions
PPTX
ADVANCED DATA STRUCTURES AND ALGORITHMS.pptx
PPT
arrayy.ppt
PPT
PPTX
Module_3_Arrays - Updated.pptx............
PPT
Chapter 10.ppt
PDF
Chapter 4 (Part I) - Array and Strings.pdf
PDF
PPTX
Ppt on arrays in c
PPTX
ARRAYS.pptx
PPTX
Data Structures - Array presentation .pptx
PPTX
Arrays in C++
PPTX
Arrays.pptx
arrays.pptx
Mesics lecture 8 arrays in 'c'
Ch-11-Arrays.ppt-1.pptx eurhrbdhdbdhrhdhdh
Basic Arrays in C Programming Language I
UNIT-5_Array in c_part1.pptx
Arrays and library functions
ADVANCED DATA STRUCTURES AND ALGORITHMS.pptx
arrayy.ppt
Module_3_Arrays - Updated.pptx............
Chapter 10.ppt
Chapter 4 (Part I) - Array and Strings.pdf
Ppt on arrays in c
ARRAYS.pptx
Data Structures - Array presentation .pptx
Arrays in C++
Arrays.pptx

More from eShikshak (20)

PDF
Modelling and evaluation
PDF
Operators in python
PDF
Datatypes in python
PDF
Introduction to python
PPT
Introduction to e commerce
PDF
Chapeter 2 introduction to cloud computing
PDF
Unit 1.4 working of cloud computing
PDF
Unit 1.3 types of cloud
PDF
Unit 1.1 introduction to cloud computing
PPT
Mesics lecture files in 'c'
PPT
Mesics lecture 7 iteration and repetitive executions
PPT
Mesics lecture 5 input – output in ‘c’
PPT
Mesics lecture 6 control statement = if -else if__else
PPT
Mesics lecture 4 c operators and experssions
PPT
Mesics lecture 5 input – output in ‘c’
PPT
Mesics lecture 3 c – constants and variables
PDF
Lecture 7 relational_and_logical_operators
PDF
Lecture21 categoriesof userdefinedfunctions.ppt
PDF
Lecture20 user definedfunctions.ppt
PDF
Lecture18 structurein c.ppt
Modelling and evaluation
Operators in python
Datatypes in python
Introduction to python
Introduction to e commerce
Chapeter 2 introduction to cloud computing
Unit 1.4 working of cloud computing
Unit 1.3 types of cloud
Unit 1.1 introduction to cloud computing
Mesics lecture files in 'c'
Mesics lecture 7 iteration and repetitive executions
Mesics lecture 5 input – output in ‘c’
Mesics lecture 6 control statement = if -else if__else
Mesics lecture 4 c operators and experssions
Mesics lecture 5 input – output in ‘c’
Mesics lecture 3 c – constants and variables
Lecture 7 relational_and_logical_operators
Lecture21 categoriesof userdefinedfunctions.ppt
Lecture20 user definedfunctions.ppt
Lecture18 structurein c.ppt

Recently uploaded (20)

PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
Cloud computing and distributed systems.
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Advanced IT Governance
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
cuic standard and advanced reporting.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Advanced Soft Computing BINUS July 2025.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PPT
Teaching material agriculture food technology
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Cloud computing and distributed systems.
Dropbox Q2 2025 Financial Results & Investor Presentation
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Advanced IT Governance
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
“AI and Expert System Decision Support & Business Intelligence Systems”
cuic standard and advanced reporting.pdf
Approach and Philosophy of On baking technology
Advanced Soft Computing BINUS July 2025.pdf
NewMind AI Weekly Chronicles - August'25 Week I
NewMind AI Monthly Chronicles - July 2025
Chapter 3 Spatial Domain Image Processing.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
20250228 LYD VKU AI Blended-Learning.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Mobile App Security Testing_ A Comprehensive Guide.pdf
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
Teaching material agriculture food technology
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf

Lecture17 arrays.ppt

  • 1. Prakash Khaire Lecturer, B V Patel Institute of BMC & IT ARRAYS
  • 2. Arrays ●It is derived data type ●Arrays are collection of data that belong to same data type ●Arrays are collection of homogeneous data ●Array elements can be accessed by its position in the array called as index ●Values in an array are identified using array name with subscripts ●Also known as subscripted variable ●It is fixed-size collection of elements
  • 3. Following are types of array ●One-dimensional Array ●Two-dimensional Array ●Multi-dimensional Array
  • 4. One-dimensional Array ●A collections of variables are given one variable name using only one subscript and such a variable is called a single-subscripted variable or one dimensional array ●Syntax data_type ArrayName[size]; data_type : is a valid data type like int, float or char Arrayname : is a valid identifier size : maximum number of elements that can be stored in array
  • 5. Arrays Array index starts with zero The last index in an array is num – 1 where num is the no of elements in a array int a[9] is an array that stores 9 integers index 0 1 2 3 4 5 6 7 8 elements Memory address 100 102 104 106 108 110 112 114 116
  • 6. Initilization of Array ●After declaring the array, all the elements of array must be initialized other wise they will contain garbage value ●At compile time ●At run time data_type ArrayName[size] = {list of values} int marks[5] = {55, 63,67,78,59};
  • 7. Each value is treated as an element of the array and is stored in the memory as follows marks 55 0 63 1 67 2 78 3 59 4
  • 8. ●float marks[5]={45.5,65.0,67.5.77.0,79 .0}; ●char name[8]={‘P’,’r’,’a’, ’k’, ’a’, ’s’, ’h’, ’0’}; ●int marks[] = {63,68,57,69,77}; ●char name[] = “Prakash”;
  • 9. int marks[5]={67,66}; ● 67 0 66 1 4646 2 8978 3 -545 4
  • 10. Two Dimensional Array ●To store following data of 4 students 201 202 203 204 205 09BCA07 45 42 41 56 46 09BCA14 46 55 70 49 56 09BCA45 65 61 68 42 56 09BCA115 46 38 39 45 42
  • 11. Two Dimensional Array ● StudentDetailsIJ ● Where, StudentDetails represents a matrix I represents no. of rows J represents no. of columns It is collection of rows and columns
  • 12. Two Dimensional Array ● Declaration of 2D array type array_name[row_size][column_size]; column0 column1 column2 column3 column4 Row0 0,0 0,1 0,2 0,3 0,4 Row1 1,0 1,1 1,2 1,3 1,4 Row2 2,0 2,1 2,2 2,3 2,4 Row3 3,0 3,1 3,2 3,3 3,4
  • 13. Storage Representation ● Similar to 1D Array, 2D array are also stored in contiguous memory in increasing memory locations. 0,0 0,1 0,2 1,0 1,1 1,2 2,0 2,1 2,2 990 992 994 996 998 1000 1002 1004 1006
  • 14. Initilization ● int mat[3][3] = { 1,3,2,4,7,6,5,8,9}; ● int mat[3][3] = { {1,3,2}, {4,7,6}, {5,8,9} };
  • 15. int mat[ ][3]={ {1,3,2}, {4,7,6}, {5,8,9} };
  • 16. int mat[3][3] = { {0}, {0}, {0} }; ● int mat[3][3] = { {1}, {7,6}, {5} }; int mat[3][3] = { {0}, {0}, {0} };
  • 17. int mat[3][3] = { 0,0,0};