SlideShare a Scribd company logo
Bhagwan mahavir college of
Engg. & Technology
Sub:Computer Programming &
Utilization(210003)
Class:Civil-c
Active Learning on :
Array
Year :Winter 2016-17
Guided By: Nisha
Bhanderi
Group Members:
1.Krunal koladiya-160060106060
2.Jay mandani-160060106069
3.Parth diyora-160060106502
4.Fenil Soni-160060106159
Index
 Introduction
 One Dimension Array
 Two Dimension Array
ARRAY
 An array is a collection of elements of the same type
that are referenced by a common name.
 Compared to the basic data type (int, float & char) it is
an aggregate or derived data type.
 All the elements of an array occupy a set of contiguous
memory locations.
ARRAY
 This absolutely has simplified our declaration of the
variables.
 We can use index or subscript to identify each
element or location in the memory.
 Hence, if we have an index of jIndex,
studMark[jIndex] would refer to the jIndexth
element in the array of studMark.
 For example, studMark[0] will refer to the first
element of the array.
 Thus by changing the value of jIndex, we could
refer to any element in the array.
 So, array has simplified our declaration and of
course, manipulation of the data.
ARRAY
One Dimensional Array: Declaration
 Dimension refers to the array's size, which is how big the
array is.
 A single or one dimensional array declaration has the
following form,
array_element_data_type array_name[array_size];
 Here, array_element_data_type define the base type of
the array, which is the type of each element in the array.
 array_name is any valid C / C++ identifier name that
obeys the same rule for the identifier naming.
 array_size defines how many elements the array will
hold.
ARRAY
 Examples of the one-dimensional array declarations,
int xNum[20], yNum[50];
float fPrice[10], fYield;
char chLetter[70];
 The first example declares two arrays named xNum and yNum of type
int. Array xNum can store up to 20 integer numbers while yNum can
store up to 50 numbers.
 The second line declares the array fPrice of type float. It can store up to
10 floating-point values.
 fYield is basic variable which shows array type can be declared together
with basic type provided the type is similar.
 The third line declares the array chLetter of type char. It can store a
string up to 69 characters.
 Why 69 instead of 70? Remember, a string has a null terminating
character (0) at the end, so we must reserve for it.
ARRAYArray Initialization
 An array may be initialized at the time of declaration.
 Giving initial values to an array.
 Initialization of an array may take the following form,
type array_name[size] = {a_list_of_value};
 For example:
int idNum[7] = {1, 2, 3, 4, 5, 6, 7};
float fFloatNum[5] = {5.6, 5.7, 5.8, 5.9, 6.1};
char chVowel[6] = {'a', 'e', 'i', 'o', 'u', '0'};
 The first line declares an integer array idNum and it immediately
assigns the values 1, 2, 3, ..., 7 to idNum[0], idNum[1], idNum[2],...,
idNum[6] respectively.
 The second line assigns the values 5.6 to fFloatNum[0], 5.7 to
fFloatNum[1], and so on.
 Similarly the third line assigns the characters 'a' to chVowel[0], 'e' to
chVowel[1], and so on. Note again, for characters we must use the
single apostrophe/quote (') to enclose them.
 Also, the last character in chVowel is NULL character ('0').
ARRAY
 Initialization of an array of type char for holding strings may take the
following form,
char array_name[size] = "string_lateral_constant";
 For example, the array chVowel in the previous example could have
been written more compactly as follows,
char chVowel[6] = "aeiou";
 When the value assigned to a character array is a string (which must be
enclosed in double quotes), the compiler automatically supplies the
NULL character but we still have to reserve one extra place for the
NULL.
 For unsized array (variable sized), we can lare as follow,
char chName[ ] = "Mr. Dracula";
 C compiler automatically creates an array which is big enough to hold
all the initializer.
ARRAY
Two Dimensional/2D Arrays
 A two dimensional array has two subscripts/indexes.
 The first subscript refers to the row, and the second, to the
column.
 Its declaration has the following form,
data_type array_name[1st
dimension size][2nd
dimension size];
 For examples,
int x Integer[3][4];
float matrixNum[20][25];
 The first line declares xInteger as an integer array with 3 rows
and 4 columns.
 Second line declares a matrixNum as a floating-point array with
20 rows and 25 columns.
12

More Related Content

What's hot

Array
ArrayArray
Array
Hajar
 
Strings IN C
Strings IN CStrings IN C
Strings IN C
yndaravind
 
Arrays
ArraysArrays
Module7
Module7Module7
Module7
Seid Hussein
 
Arrays and strings in c++
Arrays and strings in c++Arrays and strings in c++
Arrays and strings in c++
GC University Faisalabad
 
C string
C stringC string
Strings in C
Strings in CStrings in C
Strings in C
Kamal Acharya
 
String in c
String in cString in c
String in c
Suneel Dogra
 
Lecture 15 - Array
Lecture 15 - ArrayLecture 15 - Array
Lecture 15 - Array
Md. Imran Hossain Showrov
 
Array Of Pointers
Array Of PointersArray Of Pointers
Array Of Pointers
Sharad Dubey
 
C++ programming (Array)
C++ programming (Array)C++ programming (Array)
C++ programming (Array)
طارق بالحارث
 
strings in c language and its importance
strings in c language and its importancestrings in c language and its importance
strings in c language and its importance
sirmanohar
 
Operation on string presentation
Operation on string presentationOperation on string presentation
Operation on string presentation
Aliul Kadir Akib
 
Strings Functions in C Programming
Strings Functions in C ProgrammingStrings Functions in C Programming
Strings Functions in C Programming
DevoAjit Gupta
 
05 c++-strings
05 c++-strings05 c++-strings
05 c++-strings
Kelly Swanson
 
Arrays
ArraysArrays
Arrays
swathi reddy
 
Arrays in c language
Arrays in c languageArrays in c language
Arrays in c language
tanmaymodi4
 
C++ lecture 04
C++ lecture 04C++ lecture 04
C++ lecture 04
HNDE Labuduwa Galle
 
String in programming language in c or c++
 String in programming language  in c or c++  String in programming language  in c or c++
String in programming language in c or c++
Samsil Arefin
 
Arrays 1D and 2D , and multi dimensional
Arrays 1D and 2D , and multi dimensional Arrays 1D and 2D , and multi dimensional
Arrays 1D and 2D , and multi dimensional
Appili Vamsi Krishna
 

What's hot (20)

Array
ArrayArray
Array
 
Strings IN C
Strings IN CStrings IN C
Strings IN C
 
Arrays
ArraysArrays
Arrays
 
Module7
Module7Module7
Module7
 
Arrays and strings in c++
Arrays and strings in c++Arrays and strings in c++
Arrays and strings in c++
 
C string
C stringC string
C string
 
Strings in C
Strings in CStrings in C
Strings in C
 
String in c
String in cString in c
String in c
 
Lecture 15 - Array
Lecture 15 - ArrayLecture 15 - Array
Lecture 15 - Array
 
Array Of Pointers
Array Of PointersArray Of Pointers
Array Of Pointers
 
C++ programming (Array)
C++ programming (Array)C++ programming (Array)
C++ programming (Array)
 
strings in c language and its importance
strings in c language and its importancestrings in c language and its importance
strings in c language and its importance
 
Operation on string presentation
Operation on string presentationOperation on string presentation
Operation on string presentation
 
Strings Functions in C Programming
Strings Functions in C ProgrammingStrings Functions in C Programming
Strings Functions in C Programming
 
05 c++-strings
05 c++-strings05 c++-strings
05 c++-strings
 
Arrays
ArraysArrays
Arrays
 
Arrays in c language
Arrays in c languageArrays in c language
Arrays in c language
 
C++ lecture 04
C++ lecture 04C++ lecture 04
C++ lecture 04
 
String in programming language in c or c++
 String in programming language  in c or c++  String in programming language  in c or c++
String in programming language in c or c++
 
Arrays 1D and 2D , and multi dimensional
Arrays 1D and 2D , and multi dimensional Arrays 1D and 2D , and multi dimensional
Arrays 1D and 2D , and multi dimensional
 

Viewers also liked

M9. industrialisasi dan perkembangan sektor industri
M9. industrialisasi dan perkembangan sektor industriM9. industrialisasi dan perkembangan sektor industri
M9. industrialisasi dan perkembangan sektor industri
erlina na
 
M5. perubahan struktur ekonomi
M5. perubahan struktur ekonomiM5. perubahan struktur ekonomi
M5. perubahan struktur ekonomi
erlina na
 
M8. peranan sektor pertanian
M8. peranan sektor pertanianM8. peranan sektor pertanian
M8. peranan sektor pertanian
erlina na
 
M10. ukm
M10. ukmM10. ukm
M10. ukm
erlina na
 
M3. sistem ekonomi indonesia
M3. sistem ekonomi indonesiaM3. sistem ekonomi indonesia
M3. sistem ekonomi indonesia
erlina na
 
M6. kemiskinan&kesenjangan pendapatan
M6. kemiskinan&kesenjangan pendapatanM6. kemiskinan&kesenjangan pendapatan
M6. kemiskinan&kesenjangan pendapatan
erlina na
 
M4. pertumbuhan ekonomi
M4. pertumbuhan ekonomiM4. pertumbuhan ekonomi
M4. pertumbuhan ekonomi
erlina na
 
M13. modal asing & utang ln
M13. modal asing & utang lnM13. modal asing & utang ln
M13. modal asing & utang ln
erlina na
 
M12. neraca pembayaran
M12. neraca pembayaranM12. neraca pembayaran
M12. neraca pembayaran
erlina na
 
M7. pembangunan ekonomi daerah
M7. pembangunan ekonomi daerahM7. pembangunan ekonomi daerah
M7. pembangunan ekonomi daerah
erlina na
 
Jornal digital 29 12-16
Jornal digital 29 12-16Jornal digital 29 12-16
Jornal digital 29 12-16
Jornal Correio do Sul
 
Artificial intelligence bsc - iso 27001 information security
Artificial intelligence   bsc - iso 27001 information securityArtificial intelligence   bsc - iso 27001 information security
Artificial intelligence bsc - iso 27001 information security
Ufuk Cebeci
 
M11. prospek ukm dalam perdagangan bebas
M11. prospek ukm dalam perdagangan bebasM11. prospek ukm dalam perdagangan bebas
M11. prospek ukm dalam perdagangan bebas
erlina na
 
M2. sejarah perekonomian indonesia
M2. sejarah perekonomian indonesiaM2. sejarah perekonomian indonesia
M2. sejarah perekonomian indonesia
erlina na
 
Las apps
Las appsLas apps
Las apps
Hoy Hoy
 
Mechanical Spider - Robotics Course Details
Mechanical Spider  - Robotics Course DetailsMechanical Spider  - Robotics Course Details
Mechanical Spider - Robotics Course Details
Academy of Robotics
 
Spider Research Projects
Spider Research ProjectsSpider Research Projects
Spider Research Projects
mm17
 
Spider 1.0
Spider 1.0Spider 1.0
Spider 1.0
vr1988
 

Viewers also liked (18)

M9. industrialisasi dan perkembangan sektor industri
M9. industrialisasi dan perkembangan sektor industriM9. industrialisasi dan perkembangan sektor industri
M9. industrialisasi dan perkembangan sektor industri
 
M5. perubahan struktur ekonomi
M5. perubahan struktur ekonomiM5. perubahan struktur ekonomi
M5. perubahan struktur ekonomi
 
M8. peranan sektor pertanian
M8. peranan sektor pertanianM8. peranan sektor pertanian
M8. peranan sektor pertanian
 
M10. ukm
M10. ukmM10. ukm
M10. ukm
 
M3. sistem ekonomi indonesia
M3. sistem ekonomi indonesiaM3. sistem ekonomi indonesia
M3. sistem ekonomi indonesia
 
M6. kemiskinan&kesenjangan pendapatan
M6. kemiskinan&kesenjangan pendapatanM6. kemiskinan&kesenjangan pendapatan
M6. kemiskinan&kesenjangan pendapatan
 
M4. pertumbuhan ekonomi
M4. pertumbuhan ekonomiM4. pertumbuhan ekonomi
M4. pertumbuhan ekonomi
 
M13. modal asing & utang ln
M13. modal asing & utang lnM13. modal asing & utang ln
M13. modal asing & utang ln
 
M12. neraca pembayaran
M12. neraca pembayaranM12. neraca pembayaran
M12. neraca pembayaran
 
M7. pembangunan ekonomi daerah
M7. pembangunan ekonomi daerahM7. pembangunan ekonomi daerah
M7. pembangunan ekonomi daerah
 
Jornal digital 29 12-16
Jornal digital 29 12-16Jornal digital 29 12-16
Jornal digital 29 12-16
 
Artificial intelligence bsc - iso 27001 information security
Artificial intelligence   bsc - iso 27001 information securityArtificial intelligence   bsc - iso 27001 information security
Artificial intelligence bsc - iso 27001 information security
 
M11. prospek ukm dalam perdagangan bebas
M11. prospek ukm dalam perdagangan bebasM11. prospek ukm dalam perdagangan bebas
M11. prospek ukm dalam perdagangan bebas
 
M2. sejarah perekonomian indonesia
M2. sejarah perekonomian indonesiaM2. sejarah perekonomian indonesia
M2. sejarah perekonomian indonesia
 
Las apps
Las appsLas apps
Las apps
 
Mechanical Spider - Robotics Course Details
Mechanical Spider  - Robotics Course DetailsMechanical Spider  - Robotics Course Details
Mechanical Spider - Robotics Course Details
 
Spider Research Projects
Spider Research ProjectsSpider Research Projects
Spider Research Projects
 
Spider 1.0
Spider 1.0Spider 1.0
Spider 1.0
 

Similar to Arrays cpu2

3.ArraysandPointers.pptx
3.ArraysandPointers.pptx3.ArraysandPointers.pptx
3.ArraysandPointers.pptx
FolkAdonis
 
Module 4- Arrays and Strings
Module 4- Arrays and StringsModule 4- Arrays and Strings
Module 4- Arrays and Strings
nikshaikh786
 
C Programming Unit-3
C Programming Unit-3C Programming Unit-3
C Programming Unit-3
Vikram Nandini
 
cprogrammingarrayaggregatetype.ppt
cprogrammingarrayaggregatetype.pptcprogrammingarrayaggregatetype.ppt
cprogrammingarrayaggregatetype.ppt
georgejustymirobi1
 
cprogrammingarrayaggregatetype (1).ppt
cprogrammingarrayaggregatetype (1).pptcprogrammingarrayaggregatetype (1).ppt
cprogrammingarrayaggregatetype (1).ppt
karunapatel13
 
cprogrammingarrayaggregatetype.ppt
cprogrammingarrayaggregatetype.pptcprogrammingarrayaggregatetype.ppt
cprogrammingarrayaggregatetype.ppt
Prasanna657934
 
cprogrammingarrayaggregatetype.ppt
cprogrammingarrayaggregatetype.pptcprogrammingarrayaggregatetype.ppt
cprogrammingarrayaggregatetype.ppt
Samitbiswas10
 
Array in C
Array in CArray in C
Array in C
adityas29
 
Introduction to Arrays in C
Introduction to Arrays in CIntroduction to Arrays in C
Introduction to Arrays in C
Thesis Scientist Private Limited
 
Chap 7(array)
Chap 7(array)Chap 7(array)
ARRAYS
ARRAYSARRAYS
ARRAYS
muniryaseen
 
C programming , array 2020
C programming , array 2020C programming , array 2020
C programming , array 2020
Osama Ghandour Geris
 
Unit ii data structure-converted
Unit  ii data structure-convertedUnit  ii data structure-converted
Unit ii data structure-converted
Shri Shankaracharya College, Bhilai,Junwani
 
Array,string structures. Best presentation pptx
Array,string structures. Best presentation pptxArray,string structures. Best presentation pptx
Array,string structures. Best presentation pptx
Kalkaye
 
Homework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdfHomework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdf
aroraopticals15
 
Arrays
ArraysArrays
C%20ARRAYS.pdf.pdf
C%20ARRAYS.pdf.pdfC%20ARRAYS.pdf.pdf
C%20ARRAYS.pdf.pdf
SukhpreetSingh519414
 
Comp102 lec 8
Comp102   lec 8Comp102   lec 8
Comp102 lec 8
Fraz Bakhsh
 
Strings Arrays
Strings ArraysStrings Arrays
Strings Arrays
phanleson
 
Array
ArrayArray

Similar to Arrays cpu2 (20)

3.ArraysandPointers.pptx
3.ArraysandPointers.pptx3.ArraysandPointers.pptx
3.ArraysandPointers.pptx
 
Module 4- Arrays and Strings
Module 4- Arrays and StringsModule 4- Arrays and Strings
Module 4- Arrays and Strings
 
C Programming Unit-3
C Programming Unit-3C Programming Unit-3
C Programming Unit-3
 
cprogrammingarrayaggregatetype.ppt
cprogrammingarrayaggregatetype.pptcprogrammingarrayaggregatetype.ppt
cprogrammingarrayaggregatetype.ppt
 
cprogrammingarrayaggregatetype (1).ppt
cprogrammingarrayaggregatetype (1).pptcprogrammingarrayaggregatetype (1).ppt
cprogrammingarrayaggregatetype (1).ppt
 
cprogrammingarrayaggregatetype.ppt
cprogrammingarrayaggregatetype.pptcprogrammingarrayaggregatetype.ppt
cprogrammingarrayaggregatetype.ppt
 
cprogrammingarrayaggregatetype.ppt
cprogrammingarrayaggregatetype.pptcprogrammingarrayaggregatetype.ppt
cprogrammingarrayaggregatetype.ppt
 
Array in C
Array in CArray in C
Array in C
 
Introduction to Arrays in C
Introduction to Arrays in CIntroduction to Arrays in C
Introduction to Arrays in C
 
Chap 7(array)
Chap 7(array)Chap 7(array)
Chap 7(array)
 
ARRAYS
ARRAYSARRAYS
ARRAYS
 
C programming , array 2020
C programming , array 2020C programming , array 2020
C programming , array 2020
 
Unit ii data structure-converted
Unit  ii data structure-convertedUnit  ii data structure-converted
Unit ii data structure-converted
 
Array,string structures. Best presentation pptx
Array,string structures. Best presentation pptxArray,string structures. Best presentation pptx
Array,string structures. Best presentation pptx
 
Homework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdfHomework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdf
 
Arrays
ArraysArrays
Arrays
 
C%20ARRAYS.pdf.pdf
C%20ARRAYS.pdf.pdfC%20ARRAYS.pdf.pdf
C%20ARRAYS.pdf.pdf
 
Comp102 lec 8
Comp102   lec 8Comp102   lec 8
Comp102 lec 8
 
Strings Arrays
Strings ArraysStrings Arrays
Strings Arrays
 
Array
ArrayArray
Array
 

Recently uploaded

A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 

Recently uploaded (20)

A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 

Arrays cpu2

  • 1. Bhagwan mahavir college of Engg. & Technology Sub:Computer Programming & Utilization(210003) Class:Civil-c
  • 2. Active Learning on : Array Year :Winter 2016-17 Guided By: Nisha Bhanderi
  • 3. Group Members: 1.Krunal koladiya-160060106060 2.Jay mandani-160060106069 3.Parth diyora-160060106502 4.Fenil Soni-160060106159
  • 4. Index  Introduction  One Dimension Array  Two Dimension Array
  • 5. ARRAY  An array is a collection of elements of the same type that are referenced by a common name.  Compared to the basic data type (int, float & char) it is an aggregate or derived data type.  All the elements of an array occupy a set of contiguous memory locations.
  • 6. ARRAY  This absolutely has simplified our declaration of the variables.  We can use index or subscript to identify each element or location in the memory.  Hence, if we have an index of jIndex, studMark[jIndex] would refer to the jIndexth element in the array of studMark.  For example, studMark[0] will refer to the first element of the array.  Thus by changing the value of jIndex, we could refer to any element in the array.  So, array has simplified our declaration and of course, manipulation of the data.
  • 7. ARRAY One Dimensional Array: Declaration  Dimension refers to the array's size, which is how big the array is.  A single or one dimensional array declaration has the following form, array_element_data_type array_name[array_size];  Here, array_element_data_type define the base type of the array, which is the type of each element in the array.  array_name is any valid C / C++ identifier name that obeys the same rule for the identifier naming.  array_size defines how many elements the array will hold.
  • 8. ARRAY  Examples of the one-dimensional array declarations, int xNum[20], yNum[50]; float fPrice[10], fYield; char chLetter[70];  The first example declares two arrays named xNum and yNum of type int. Array xNum can store up to 20 integer numbers while yNum can store up to 50 numbers.  The second line declares the array fPrice of type float. It can store up to 10 floating-point values.  fYield is basic variable which shows array type can be declared together with basic type provided the type is similar.  The third line declares the array chLetter of type char. It can store a string up to 69 characters.  Why 69 instead of 70? Remember, a string has a null terminating character (0) at the end, so we must reserve for it.
  • 9. ARRAYArray Initialization  An array may be initialized at the time of declaration.  Giving initial values to an array.  Initialization of an array may take the following form, type array_name[size] = {a_list_of_value};  For example: int idNum[7] = {1, 2, 3, 4, 5, 6, 7}; float fFloatNum[5] = {5.6, 5.7, 5.8, 5.9, 6.1}; char chVowel[6] = {'a', 'e', 'i', 'o', 'u', '0'};  The first line declares an integer array idNum and it immediately assigns the values 1, 2, 3, ..., 7 to idNum[0], idNum[1], idNum[2],..., idNum[6] respectively.  The second line assigns the values 5.6 to fFloatNum[0], 5.7 to fFloatNum[1], and so on.  Similarly the third line assigns the characters 'a' to chVowel[0], 'e' to chVowel[1], and so on. Note again, for characters we must use the single apostrophe/quote (') to enclose them.  Also, the last character in chVowel is NULL character ('0').
  • 10. ARRAY  Initialization of an array of type char for holding strings may take the following form, char array_name[size] = "string_lateral_constant";  For example, the array chVowel in the previous example could have been written more compactly as follows, char chVowel[6] = "aeiou";  When the value assigned to a character array is a string (which must be enclosed in double quotes), the compiler automatically supplies the NULL character but we still have to reserve one extra place for the NULL.  For unsized array (variable sized), we can lare as follow, char chName[ ] = "Mr. Dracula";  C compiler automatically creates an array which is big enough to hold all the initializer.
  • 11. ARRAY Two Dimensional/2D Arrays  A two dimensional array has two subscripts/indexes.  The first subscript refers to the row, and the second, to the column.  Its declaration has the following form, data_type array_name[1st dimension size][2nd dimension size];  For examples, int x Integer[3][4]; float matrixNum[20][25];  The first line declares xInteger as an integer array with 3 rows and 4 columns.  Second line declares a matrixNum as a floating-point array with 20 rows and 25 columns.
  • 12. 12