SlideShare a Scribd company logo
3
Most read
4
Most read
10
Most read
Array in C Language
Index

Introducing Arrays.
Declaration of a Array. Variables,
 Creating Arrays.
The Length of Arrays.
Initializing Arrays.
Multidimensional Arrays.
Introducing Arrays
 Array is a data structure that represents a
  collection of the same types of data.
                int num[10];
Num reference                  num [0]
                               num[1]
                               num[2]
                               num [3]
                                         An Array of 10 Elements
                               num[4]    of type int.
                               num[5]
                               num[6]
                               num[7]
                               num[8]
                               num[9]
Declaring Array Variables


 Data type array name[index];
   Example:
            int list[10];
          char num[15];
          float hat[20];
Creating Arrays
 Data type array-name[size];
  Example:
          int num[10];


 num[0]references the first element in the
 array.
 num[9]references the last element in the
 array.
The Length of Arrays
 Once an array is created, its size is fixed. It
  cannot be changed.
  For Example,
              int arr[10];


   You can not insert any number to arr[11]
  location because it is not initialized.
Initializing Arrays

 Declaring, creating, initializing in one
  step:
    int my Array[5] = {1, 2, 3, 4, 5};
    int studentAge[4];
        studentAge[0] = 14;
        studentAge[1] = 13;
        studentAge[2] = 15;
        studentAge[3] = 16;
Multidimensional Arrays
  int matrix[10] [10];
for (i=0; i<10; i++)
  for (j=0; j<10; j++)
{
     matrix[i] [j] = i * j;
     }

float mat[5] [5];
Multidimensional Array
          Illustration
    0   1    2   3   4       0   1    2   3   4
                                                           0    1        2
0                        0
                                                  0        1    2        3
1                        1
                                                  1        4    5        6
2                        2       7
                                                  2        7    8        9
3                        3
                                                  3        10   11       12
4                        4

int matrix[5] [5];                                    int[][] array ={
                         matrix[2] [1] = 7
                                                      {1, 2, 3},
                                                      {4, 5, 6},
                                                      {7, 8, 9},
                                                      {10, 11, 12}};
Initializing of
           Multidimensional Arrays
To declare, create and initialize a
  multidimensional array.
For example,
     int[][] array = {
       {1, 2, 3},
       {4, 5, 6},
       {7, 8, 9},
       {10, 11, 12}
};

This is equivalent to the following statements:
      array[0][0] = 1;    array[0][1] = 2; array[0][2] = 3;
      array[1][0] = 4;    array[1][1] = 5; array[1][2] = 6;
      array[2][0] = 7;    array[2][1] = 8; array[2][2] = 9;
      array[3][0] = 10;   array[3][1] = 11; array[3][2] = 12;
Ad

Recommended

Transformer on no load
Transformer on no load
Gurkirat Singh
 
Array in c
Array in c
Ravi Gelani
 
Lecture-2(2): Number System & Conversion
Lecture-2(2): Number System & Conversion
Mubashir Ali
 
Lecture 07
Lecture 07
Sehrish Rafiq
 
Number System
Number System
itutor
 
Number system
Number system
Sajib
 
Array in c#
Array in c#
Prem Kumar Badri
 
Array in C
Array in C
adityas29
 
Array Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional array
imtiazalijoono
 
Arrays in Java
Arrays in Java
Naz Abdalla
 
linked list in data structure
linked list in data structure
shameen khan
 
Strings in C
Strings in C
Kamal Acharya
 
JAVA AWT
JAVA AWT
shanmuga rajan
 
Linked list
Linked list
akshat360
 
Introduction to Array ppt
Introduction to Array ppt
sandhya yadav
 
Structure in C
Structure in C
Kamal Acharya
 
Union in C programming
Union in C programming
Kamal Acharya
 
Array in c++
Array in c++
Mahesha Mano
 
Threads in JAVA
Threads in JAVA
Haldia Institute of Technology
 
Introduction to Python
Introduction to Python
Mohammed Sikander
 
Strings in Java
Strings in Java
Abhilash Nair
 
Arrays in c
Arrays in c
Jeeva Nanthini
 
Constructor in java
Constructor in java
Pavith Gunasekara
 
2D Array
2D Array
Ehatsham Riaz
 
Strings
Strings
Mitali Chugh
 
Strings in C language
Strings in C language
P M Patil
 
header, circular and two way linked lists
header, circular and two way linked lists
student
 
Two dimensional arrays
Two dimensional arrays
Neeru Mittal
 
Structure in C
Structure in C
Fazle Rabbi Ador
 
Structure c
Structure c
thirumalaikumar3
 

More Related Content

What's hot (20)

Array Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional array
imtiazalijoono
 
Arrays in Java
Arrays in Java
Naz Abdalla
 
linked list in data structure
linked list in data structure
shameen khan
 
Strings in C
Strings in C
Kamal Acharya
 
JAVA AWT
JAVA AWT
shanmuga rajan
 
Linked list
Linked list
akshat360
 
Introduction to Array ppt
Introduction to Array ppt
sandhya yadav
 
Structure in C
Structure in C
Kamal Acharya
 
Union in C programming
Union in C programming
Kamal Acharya
 
Array in c++
Array in c++
Mahesha Mano
 
Threads in JAVA
Threads in JAVA
Haldia Institute of Technology
 
Introduction to Python
Introduction to Python
Mohammed Sikander
 
Strings in Java
Strings in Java
Abhilash Nair
 
Arrays in c
Arrays in c
Jeeva Nanthini
 
Constructor in java
Constructor in java
Pavith Gunasekara
 
2D Array
2D Array
Ehatsham Riaz
 
Strings
Strings
Mitali Chugh
 
Strings in C language
Strings in C language
P M Patil
 
header, circular and two way linked lists
header, circular and two way linked lists
student
 
Two dimensional arrays
Two dimensional arrays
Neeru Mittal
 

Viewers also liked (8)

Structure in C
Structure in C
Fazle Rabbi Ador
 
Structure c
Structure c
thirumalaikumar3
 
String functions in C
String functions in C
baabtra.com - No. 1 supplier of quality freshers
 
Structure of a C program
Structure of a C program
David Livingston J
 
Structure in c
Structure in c
baabtra.com - No. 1 supplier of quality freshers
 
Arrays in C language
Arrays in C language
Shubham Sharma
 
String c
String c
thirumalaikumar3
 
String in c
String in c
Suneel Dogra
 
Ad

Similar to Array in c language (20)

Arrays
Arrays
Learn By Watch
 
07slide
07slide
Dorothea Chaffin
 
JavaYDL7
JavaYDL7
Terry Yoast
 
7. arrays
7. arrays
웅식 전
 
รายงานคอม
รายงานคอม
Areeya Onnom
 
รายงานคอม
รายงานคอม
Areeya Onnom
 
Arrays and library functions
Arrays and library functions
Swarup Kumar Boro
 
C++ arrays part2
C++ arrays part2
Subhasis Nayak
 
Mesics lecture 8 arrays in 'c'
Mesics lecture 8 arrays in 'c'
eShikshak
 
Array in c language
Array in c language
umesh patil
 
Array
Array
Mayank Saxena
 
Lecture17 arrays.ppt
Lecture17 arrays.ppt
eShikshak
 
Arrays
Arrays
SARITHA REDDY
 
Fp201 unit4
Fp201 unit4
rohassanie
 
Arrays in C++
Arrays in C++
Kashif Nawab
 
Array
Array
PralhadKhanal1
 
Multidimensional arrays in C++
Multidimensional arrays in C++
Ilio Catallo
 
2 arrays
2 arrays
trixiacruz
 
Module_3_Arrays - Updated.pptx............
Module_3_Arrays - Updated.pptx............
ChiragKankani
 
Data structure.pptx
Data structure.pptx
SajalFayyaz
 
Ad

More from home (9)

3D Printer
3D Printer
home
 
Software project management by Walker Royce
Software project management by Walker Royce
home
 
Asp interview Question and Answer
Asp interview Question and Answer
home
 
Matrimonial web site Documentation
Matrimonial web site Documentation
home
 
Linux
Linux
home
 
Internet Technology
Internet Technology
home
 
Internet Technology
Internet Technology
home
 
Internet Technology
Internet Technology
home
 
Software techniques
Software techniques
home
 
3D Printer
3D Printer
home
 
Software project management by Walker Royce
Software project management by Walker Royce
home
 
Asp interview Question and Answer
Asp interview Question and Answer
home
 
Matrimonial web site Documentation
Matrimonial web site Documentation
home
 
Linux
Linux
home
 
Internet Technology
Internet Technology
home
 
Internet Technology
Internet Technology
home
 
Internet Technology
Internet Technology
home
 
Software techniques
Software techniques
home
 

Recently uploaded (20)

Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
 
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Nilesh Gule
 
The Future of Product Management in AI ERA.pdf
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
"Database isolation: how we deal with hundreds of direct connections to the d...
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
 
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
2025_06_18 - OpenMetadata Community Meeting.pdf
2025_06_18 - OpenMetadata Community Meeting.pdf
OpenMetadata
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
10 Key Challenges for AI within the EU Data Protection Framework.pdf
10 Key Challenges for AI within the EU Data Protection Framework.pdf
Priyanka Aash
 
Mastering AI Workflows with FME by Mark Döring
Mastering AI Workflows with FME by Mark Döring
Safe Software
 
PyCon SG 25 - Firecracker Made Easy with Python.pdf
PyCon SG 25 - Firecracker Made Easy with Python.pdf
Muhammad Yuga Nugraha
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
 
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Josef Weingand
 
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
Fwdays
 
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Safe Software
 
From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
 
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
Fwdays
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
 
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Nilesh Gule
 
The Future of Product Management in AI ERA.pdf
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
"Database isolation: how we deal with hundreds of direct connections to the d...
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
 
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
2025_06_18 - OpenMetadata Community Meeting.pdf
2025_06_18 - OpenMetadata Community Meeting.pdf
OpenMetadata
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
10 Key Challenges for AI within the EU Data Protection Framework.pdf
10 Key Challenges for AI within the EU Data Protection Framework.pdf
Priyanka Aash
 
Mastering AI Workflows with FME by Mark Döring
Mastering AI Workflows with FME by Mark Döring
Safe Software
 
PyCon SG 25 - Firecracker Made Easy with Python.pdf
PyCon SG 25 - Firecracker Made Easy with Python.pdf
Muhammad Yuga Nugraha
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
 
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Josef Weingand
 
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
Fwdays
 
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Safe Software
 
From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
 
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
Fwdays
 

Array in c language

  • 1. Array in C Language
  • 2. Index Introducing Arrays. Declaration of a Array. Variables, Creating Arrays. The Length of Arrays. Initializing Arrays. Multidimensional Arrays.
  • 3. Introducing Arrays  Array is a data structure that represents a collection of the same types of data. int num[10]; Num reference num [0] num[1] num[2] num [3] An Array of 10 Elements num[4] of type int. num[5] num[6] num[7] num[8] num[9]
  • 4. Declaring Array Variables  Data type array name[index]; Example: int list[10]; char num[15]; float hat[20];
  • 5. Creating Arrays  Data type array-name[size]; Example: int num[10]; num[0]references the first element in the array. num[9]references the last element in the array.
  • 6. The Length of Arrays  Once an array is created, its size is fixed. It cannot be changed. For Example, int arr[10]; You can not insert any number to arr[11] location because it is not initialized.
  • 7. Initializing Arrays  Declaring, creating, initializing in one step: int my Array[5] = {1, 2, 3, 4, 5}; int studentAge[4]; studentAge[0] = 14; studentAge[1] = 13; studentAge[2] = 15; studentAge[3] = 16;
  • 8. Multidimensional Arrays int matrix[10] [10]; for (i=0; i<10; i++) for (j=0; j<10; j++) { matrix[i] [j] = i * j; } float mat[5] [5];
  • 9. Multidimensional Array Illustration 0 1 2 3 4 0 1 2 3 4 0 1 2 0 0 0 1 2 3 1 1 1 4 5 6 2 2 7 2 7 8 9 3 3 3 10 11 12 4 4 int matrix[5] [5]; int[][] array ={ matrix[2] [1] = 7 {1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}};
  • 10. Initializing of Multidimensional Arrays To declare, create and initialize a multidimensional array. For example, int[][] array = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12} }; This is equivalent to the following statements: array[0][0] = 1; array[0][1] = 2; array[0][2] = 3; array[1][0] = 4; array[1][1] = 5; array[1][2] = 6; array[2][0] = 7; array[2][1] = 8; array[2][2] = 9; array[3][0] = 10; array[3][1] = 11; array[3][2] = 12;