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
An Array of 10 Elements
of type int.
num [0]
num[1]
num[2]
num [3]
num[4]
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 3 4
0
1
2 7
3
4
int matrix[5] [5]; matrix[2] [1] = 7
0 1 2
0 1 2 3
1 4 5 6
2 7 8 9
3 10 11 12
int[][] array ={
{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;

More Related Content

What's hot (20)

PPTX
C++ lecture 04
HNDE Labuduwa Galle
 
PPTX
Arrays basics
sudhirvegad
 
PPSX
C Programming : Arrays
Gagan Deep
 
PPTX
Array in c programming
Mazharul Islam
 
PPT
Arrays in c
vampugani
 
PPTX
Array in C
Kamal Acharya
 
PPTX
One dimensional arrays
Satyam Soni
 
PPTX
Array in c
AnIsh Kumar
 
PPTX
Arrays in C language
Shubham Sharma
 
PPT
Arrays Class presentation
Neveen Reda
 
PPTX
Array Introduction One-dimensional array Multidimensional array
imtiazalijoono
 
PPTX
Array in c programming
2569294Mohan
 
PPTX
Arrays in c
Jeeva Nanthini
 
PPTX
Programming in c Arrays
janani thirupathi
 
PPT
C programming , array 2020
Osama Ghandour Geris
 
PPTX
Programming in c arrays
Uma mohan
 
PPTX
Introduction to Array ppt
sandhya yadav
 
PPTX
Arrays C#
Raghuveer Guthikonda
 
PPTX
Array in (C) programing
mJafarww
 
C++ lecture 04
HNDE Labuduwa Galle
 
Arrays basics
sudhirvegad
 
C Programming : Arrays
Gagan Deep
 
Array in c programming
Mazharul Islam
 
Arrays in c
vampugani
 
Array in C
Kamal Acharya
 
One dimensional arrays
Satyam Soni
 
Array in c
AnIsh Kumar
 
Arrays in C language
Shubham Sharma
 
Arrays Class presentation
Neveen Reda
 
Array Introduction One-dimensional array Multidimensional array
imtiazalijoono
 
Array in c programming
2569294Mohan
 
Arrays in c
Jeeva Nanthini
 
Programming in c Arrays
janani thirupathi
 
C programming , array 2020
Osama Ghandour Geris
 
Programming in c arrays
Uma mohan
 
Introduction to Array ppt
sandhya yadav
 
Array in (C) programing
mJafarww
 

Viewers also liked (12)

PPT
Sistema de informacion institucional,ok
johnnyhp14
 
PDF
WORKSHOPS_FIE2016
WAJID HUSSAIN
 
PDF
ABET_WORKSHOP_CERTIFICATION2
WAJID HUSSAIN
 
PPTX
TSHOOT Solution for CISCO DEMO
Biswadip Goswami
 
PDF
Shahid Lecture-8- MKAG1273
nchakori
 
PPT
Your First ASP_Net project part 1
Biswadip Goswami
 
PDF
Fagan Inspection
ECC International
 
PPTX
Redis Labs and SQL Server
Lynn Langit
 
DOC
Company Vehicle Use Agreement
John Keller
 
PPTX
The End of Security as We Know It - Shannon Lietz
SeniorStoryteller
 
DOC
CLbf-cvbf--2016
ARUN KUMAR RAMACHANDRAN
 
PDF
Top 100 best hollywood actors of all time copied by samir rafla from im db
Alexandria University, Egypt
 
Sistema de informacion institucional,ok
johnnyhp14
 
WORKSHOPS_FIE2016
WAJID HUSSAIN
 
ABET_WORKSHOP_CERTIFICATION2
WAJID HUSSAIN
 
TSHOOT Solution for CISCO DEMO
Biswadip Goswami
 
Shahid Lecture-8- MKAG1273
nchakori
 
Your First ASP_Net project part 1
Biswadip Goswami
 
Fagan Inspection
ECC International
 
Redis Labs and SQL Server
Lynn Langit
 
Company Vehicle Use Agreement
John Keller
 
The End of Security as We Know It - Shannon Lietz
SeniorStoryteller
 
CLbf-cvbf--2016
ARUN KUMAR RAMACHANDRAN
 
Top 100 best hollywood actors of all time copied by samir rafla from im db
Alexandria University, Egypt
 
Ad

Similar to Array in c language (20)

PPTX
Array in c language
sanjay joshi
 
PPTX
pptt.pptx
SubhamMukherjee42
 
PPTX
Basic array in c programming
Sajid Hasan
 
PDF
Array and its types and it's implemented programming Final.pdf
ajajkhan16
 
PDF
Arrays
Steven Wallach
 
PPTX
Chapter 13.pptx
AnisZahirahAzman
 
PDF
Array
hjasjhd
 
PPTX
Arrays & Strings
Munazza-Mah-Jabeen
 
PDF
Array in C full basic explanation
TeresaJencyBala
 
PPTX
Array
HarshKumar943076
 
PPTX
BHARGAVIARRAY.PPT.pptx
Sasideepa
 
PPTX
Ch8 Arrays
SzeChingChen
 
PPTX
Array.pptx
fixocin377
 
PPTX
array-160309152651.pptx
karunapatel13
 
PPTX
c unit programming arrays in detail 3.pptx
anithaviyyapu237
 
PDF
Array&amp;string
chanchal ghosh
 
PPTX
Array
Anil Dutt
 
PPTX
3.ArraysandPointers.pptx
FolkAdonis
 
Array in c language
sanjay joshi
 
Basic array in c programming
Sajid Hasan
 
Array and its types and it's implemented programming Final.pdf
ajajkhan16
 
Chapter 13.pptx
AnisZahirahAzman
 
Array
hjasjhd
 
Arrays & Strings
Munazza-Mah-Jabeen
 
Array in C full basic explanation
TeresaJencyBala
 
BHARGAVIARRAY.PPT.pptx
Sasideepa
 
Ch8 Arrays
SzeChingChen
 
Array.pptx
fixocin377
 
array-160309152651.pptx
karunapatel13
 
c unit programming arrays in detail 3.pptx
anithaviyyapu237
 
Array&amp;string
chanchal ghosh
 
Array
Anil Dutt
 
3.ArraysandPointers.pptx
FolkAdonis
 
Ad

More from umesh patil (20)

PPTX
Ccna security
umesh patil
 
PPTX
Jquery Preparation
umesh patil
 
PPTX
Cloud computing
umesh patil
 
PPT
Static and dynamic polymorphism
umesh patil
 
PPTX
Introduction to asp .net
umesh patil
 
PPTX
C language
umesh patil
 
PPTX
Html and css presentation
umesh patil
 
PPTX
Html Presentation
umesh patil
 
PPTX
Cloud computing
umesh patil
 
PPT
Oops and c fundamentals
umesh patil
 
PPT
Java script
umesh patil
 
PPTX
Function in c program
umesh patil
 
PPTX
css and wordpress
umesh patil
 
PPTX
css and wordpress
umesh patil
 
PPTX
Php vs asp
umesh patil
 
PPTX
Ccna security
umesh patil
 
PPT
Cloud computing
umesh patil
 
PPTX
Cloud computing
umesh patil
 
PPS
C language
umesh patil
 
PPT
Visual basic
umesh patil
 
Ccna security
umesh patil
 
Jquery Preparation
umesh patil
 
Cloud computing
umesh patil
 
Static and dynamic polymorphism
umesh patil
 
Introduction to asp .net
umesh patil
 
C language
umesh patil
 
Html and css presentation
umesh patil
 
Html Presentation
umesh patil
 
Cloud computing
umesh patil
 
Oops and c fundamentals
umesh patil
 
Java script
umesh patil
 
Function in c program
umesh patil
 
css and wordpress
umesh patil
 
css and wordpress
umesh patil
 
Php vs asp
umesh patil
 
Ccna security
umesh patil
 
Cloud computing
umesh patil
 
Cloud computing
umesh patil
 
C language
umesh patil
 
Visual basic
umesh patil
 

Recently uploaded (20)

PDF
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
PDF
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
PPTX
QUARTER 1 WEEK 2 PLOT, POV AND CONFLICTS
KynaParas
 
PPTX
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
PDF
Exploring the Different Types of Experimental Research
Thelma Villaflores
 
PPT
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
PPTX
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
PPTX
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
PPTX
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
PDF
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
PDF
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PPTX
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
PDF
Horarios de distribución de agua en julio
pegazohn1978
 
PPTX
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
PDF
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PPT
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
PDF
The Different Types of Non-Experimental Research
Thelma Villaflores
 
PDF
Geographical Diversity of India 100 Mcq.pdf/ 7th class new ncert /Social/Samy...
Sandeep Swamy
 
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
QUARTER 1 WEEK 2 PLOT, POV AND CONFLICTS
KynaParas
 
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
Exploring the Different Types of Experimental Research
Thelma Villaflores
 
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
Horarios de distribución de agua en julio
pegazohn1978
 
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
The Different Types of Non-Experimental Research
Thelma Villaflores
 
Geographical Diversity of India 100 Mcq.pdf/ 7th class new ncert /Social/Samy...
Sandeep Swamy
 

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 An Array of 10 Elements of type int. num [0] num[1] num[2] num [3] num[4] 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 3 4 0 1 2 7 3 4 int matrix[5] [5]; matrix[2] [1] = 7 0 1 2 0 1 2 3 1 4 5 6 2 7 8 9 3 10 11 12 int[][] array ={ {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;