SlideShare a Scribd company logo
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

More Related Content

What's hot (20)

Arrays in c
Arrays in cArrays in c
Arrays in c
Jeeva Nanthini
 
Two dimensional arrays
Two dimensional arraysTwo dimensional arrays
Two dimensional arrays
Neeru Mittal
 
Array Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayArray Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional array
imtiazalijoono
 
Array in c programming
Array in c programmingArray in c programming
Array in c programming
Mazharul Islam
 
Presentation on array
Presentation on array Presentation on array
Presentation on array
topu93
 
One Dimensional Array
One Dimensional Array One Dimensional Array
One Dimensional Array
dincyjain
 
Introduction to Array ppt
Introduction to Array pptIntroduction to Array ppt
Introduction to Array ppt
sandhya yadav
 
Arrays in java
Arrays in javaArrays in java
Arrays in java
Arzath Areeff
 
arrays of structures
arrays of structuresarrays of structures
arrays of structures
arushi bhatnagar
 
6. static keyword
6. static keyword6. static keyword
6. static keyword
Indu Sharma Bhardwaj
 
concept of Array, 1D & 2D array
concept of Array, 1D & 2D arrayconcept of Array, 1D & 2D array
concept of Array, 1D & 2D array
Sangani Ankur
 
C string
C stringC string
C string
University of Potsdam
 
Strings in C
Strings in CStrings in C
Strings in C
Kamal Acharya
 
Multidimensional array in C
Multidimensional array in CMultidimensional array in C
Multidimensional array in C
Smit Parikh
 
Arrays In C Language
Arrays In C LanguageArrays In C Language
Arrays In C Language
Surbhi Yadav
 
Array
ArrayArray
Array
Anil Neupane
 
sparse matrix in data structure
sparse matrix in data structuresparse matrix in data structure
sparse matrix in data structure
MAHALAKSHMI P
 
Dynamic memory allocation
Dynamic memory allocationDynamic memory allocation
Dynamic memory allocation
Viji B
 
ARRAY
ARRAYARRAY
ARRAY
ayush raj
 
Understanding java streams
Understanding java streamsUnderstanding java streams
Understanding java streams
Shahjahan Samoon
 
Two dimensional arrays
Two dimensional arraysTwo dimensional arrays
Two dimensional arrays
Neeru Mittal
 
Array Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayArray Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional array
imtiazalijoono
 
Array in c programming
Array in c programmingArray in c programming
Array in c programming
Mazharul Islam
 
Presentation on array
Presentation on array Presentation on array
Presentation on array
topu93
 
One Dimensional Array
One Dimensional Array One Dimensional Array
One Dimensional Array
dincyjain
 
Introduction to Array ppt
Introduction to Array pptIntroduction to Array ppt
Introduction to Array ppt
sandhya yadav
 
concept of Array, 1D & 2D array
concept of Array, 1D & 2D arrayconcept of Array, 1D & 2D array
concept of Array, 1D & 2D array
Sangani Ankur
 
Multidimensional array in C
Multidimensional array in CMultidimensional array in C
Multidimensional array in C
Smit Parikh
 
Arrays In C Language
Arrays In C LanguageArrays In C Language
Arrays In C Language
Surbhi Yadav
 
sparse matrix in data structure
sparse matrix in data structuresparse matrix in data structure
sparse matrix in data structure
MAHALAKSHMI P
 
Dynamic memory allocation
Dynamic memory allocationDynamic memory allocation
Dynamic memory allocation
Viji B
 
Understanding java streams
Understanding java streamsUnderstanding java streams
Understanding java streams
Shahjahan Samoon
 

Viewers also liked (8)

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

Similar to Array in c language (20)

Arrays in CPP
Arrays in CPPArrays in CPP
Arrays in CPP
Shakila Mahjabin
 
JavaYDL7
JavaYDL7JavaYDL7
JavaYDL7
Terry Yoast
 
07slide
07slide07slide
07slide
Dorothea Chaffin
 
Multi dimensional arrays
Multi dimensional arraysMulti dimensional arrays
Multi dimensional arrays
Aseelhalees
 
pptt.pptx
pptt.pptxpptt.pptx
pptt.pptx
SubhamMukherjee42
 
Lecture17 arrays.ppt
Lecture17 arrays.pptLecture17 arrays.ppt
Lecture17 arrays.ppt
eShikshak
 
Array
ArrayArray
Array
Kongu Engineering College, Perundurai, Erode
 
Arrays
ArraysArrays
Arrays
Learn By Watch
 
array
array array
array
Yaswanth Babu Gummadivelli
 
รายงานคอม
รายงานคอมรายงานคอม
รายงานคอม
Areeya Onnom
 
Array
ArrayArray
Array
PRN USM
 
7. arrays
7. arrays7. arrays
7. arrays
웅식 전
 
Array
ArrayArray
Array
HarshKumar943076
 
Array in c language
Array in c languageArray in c language
Array in c language
umesh patil
 
Array in c language
Array in c languageArray in c language
Array in c language
sanjay joshi
 
รายงานคอม
รายงานคอมรายงานคอม
รายงานคอม
Areeya Onnom
 
L10 array
L10 arrayL10 array
L10 array
teach4uin
 
Unit4 Slides
Unit4 SlidesUnit4 Slides
Unit4 Slides
Anurag University Hyderabad
 
Lecture 6 - Arrays
Lecture 6 - ArraysLecture 6 - Arrays
Lecture 6 - Arrays
Syed Afaq Shah MACS CP
 
Arrays
ArraysArrays
Arrays
Andy Juan Sarango Veliz
 
Ad

More from home (9)

3D Printer
3D Printer3D Printer
3D Printer
home
 
Software project management by Walker Royce
Software project management by Walker RoyceSoftware project management by Walker Royce
Software project management by Walker Royce
home
 
Asp interview Question and Answer
Asp interview Question and Answer Asp interview Question and Answer
Asp interview Question and Answer
home
 
Matrimonial web site Documentation
Matrimonial web site DocumentationMatrimonial web site Documentation
Matrimonial web site Documentation
home
 
Linux
LinuxLinux
Linux
home
 
Internet Technology
Internet TechnologyInternet Technology
Internet Technology
home
 
Internet Technology
Internet TechnologyInternet Technology
Internet Technology
home
 
Internet Technology
Internet TechnologyInternet Technology
Internet Technology
home
 
Software techniques
Software techniquesSoftware techniques
Software techniques
home
 
3D Printer
3D Printer3D Printer
3D Printer
home
 
Software project management by Walker Royce
Software project management by Walker RoyceSoftware project management by Walker Royce
Software project management by Walker Royce
home
 
Asp interview Question and Answer
Asp interview Question and Answer Asp interview Question and Answer
Asp interview Question and Answer
home
 
Matrimonial web site Documentation
Matrimonial web site DocumentationMatrimonial web site Documentation
Matrimonial web site Documentation
home
 
Linux
LinuxLinux
Linux
home
 
Internet Technology
Internet TechnologyInternet Technology
Internet Technology
home
 
Internet Technology
Internet TechnologyInternet Technology
Internet Technology
home
 
Internet Technology
Internet TechnologyInternet Technology
Internet Technology
home
 
Software techniques
Software techniquesSoftware techniques
Software techniques
home
 

Recently uploaded (20)

UiPath Agentic Automation: Community Developer Opportunities
UiPath Agentic Automation: Community Developer OpportunitiesUiPath Agentic Automation: Community Developer Opportunities
UiPath Agentic Automation: Community Developer Opportunities
DianaGray10
 
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Mike Mingos
 
Build With AI - In Person Session Slides.pdf
Build With AI - In Person Session Slides.pdfBuild With AI - In Person Session Slides.pdf
Build With AI - In Person Session Slides.pdf
Google Developer Group - Harare
 
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier VroomAI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
UXPA Boston
 
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz
 
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
James Anderson
 
IT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information TechnologyIT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information Technology
SHEHABALYAMANI
 
Webinar - Top 5 Backup Mistakes MSPs and Businesses Make .pptx
Webinar - Top 5 Backup Mistakes MSPs and Businesses Make   .pptxWebinar - Top 5 Backup Mistakes MSPs and Businesses Make   .pptx
Webinar - Top 5 Backup Mistakes MSPs and Businesses Make .pptx
MSP360
 
Config 2025 presentation recap covering both days
Config 2025 presentation recap covering both daysConfig 2025 presentation recap covering both days
Config 2025 presentation recap covering both days
TrishAntoni1
 
Unlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web AppsUnlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web Apps
Maximiliano Firtman
 
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
SOFTTECHHUB
 
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Markus Eisele
 
Slack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teamsSlack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teams
Nacho Cougil
 
fennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solutionfennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solution
shallal2
 
Q1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor PresentationQ1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor Presentation
Dropbox
 
AI You Can Trust: The Critical Role of Governance and Quality.pdf
AI You Can Trust: The Critical Role of Governance and Quality.pdfAI You Can Trust: The Critical Role of Governance and Quality.pdf
AI You Can Trust: The Critical Role of Governance and Quality.pdf
Precisely
 
Shoehorning dependency injection into a FP language, what does it take?
Shoehorning dependency injection into a FP language, what does it take?Shoehorning dependency injection into a FP language, what does it take?
Shoehorning dependency injection into a FP language, what does it take?
Eric Torreborre
 
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à GenèveUiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPathCommunity
 
How to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabberHow to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabber
eGrabber
 
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptxSmart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Seasia Infotech
 
UiPath Agentic Automation: Community Developer Opportunities
UiPath Agentic Automation: Community Developer OpportunitiesUiPath Agentic Automation: Community Developer Opportunities
UiPath Agentic Automation: Community Developer Opportunities
DianaGray10
 
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Mike Mingos
 
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier VroomAI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
UXPA Boston
 
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz
 
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
James Anderson
 
IT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information TechnologyIT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information Technology
SHEHABALYAMANI
 
Webinar - Top 5 Backup Mistakes MSPs and Businesses Make .pptx
Webinar - Top 5 Backup Mistakes MSPs and Businesses Make   .pptxWebinar - Top 5 Backup Mistakes MSPs and Businesses Make   .pptx
Webinar - Top 5 Backup Mistakes MSPs and Businesses Make .pptx
MSP360
 
Config 2025 presentation recap covering both days
Config 2025 presentation recap covering both daysConfig 2025 presentation recap covering both days
Config 2025 presentation recap covering both days
TrishAntoni1
 
Unlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web AppsUnlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web Apps
Maximiliano Firtman
 
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
SOFTTECHHUB
 
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Markus Eisele
 
Slack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teamsSlack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teams
Nacho Cougil
 
fennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solutionfennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solution
shallal2
 
Q1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor PresentationQ1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor Presentation
Dropbox
 
AI You Can Trust: The Critical Role of Governance and Quality.pdf
AI You Can Trust: The Critical Role of Governance and Quality.pdfAI You Can Trust: The Critical Role of Governance and Quality.pdf
AI You Can Trust: The Critical Role of Governance and Quality.pdf
Precisely
 
Shoehorning dependency injection into a FP language, what does it take?
Shoehorning dependency injection into a FP language, what does it take?Shoehorning dependency injection into a FP language, what does it take?
Shoehorning dependency injection into a FP language, what does it take?
Eric Torreborre
 
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à GenèveUiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPathCommunity
 
How to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabberHow to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabber
eGrabber
 
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptxSmart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Seasia Infotech
 

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;
  翻译: