# How do arrays compare with variables and how do they differ- Give a si.docx

How do arrays compare with variables and how do they differ? Give a simple example (Programming Logic and Design) Solution Arrays : Array is a homogeneous (same kind of elements) collection of elements in memory in a contagious locations. The first element of array is stored at index =0 and last element is stored at index=size-1. For example, int marks [5] ={10,20,30,40,50}; 10 20 30 40 50 Variable : The variable is a name given to memory location in a computer memory. The element is stored in that memory location can be pointed by the variable name. For example, int id=10; Where id is a name given to the memory location where the value 10 is stored. Comparison of array elements with variables : Since arrays are stored index based, the elements are compared using index location of the element in an array. int min=50; for(int i=0;i<5;i++) //comparison of array element with variable, min if(marks[index]==min) //code follows .

1 of 2

## Recommended

DSA UNIT II ARRAY AND LIST - notes
DSA UNIT II ARRAY AND LIST - notesswathirajstar

One dimensional arrays
One dimensional arraysSatyam Soni

Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm KristinaBorooah

Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT
Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT LATHA LAKSHMI

9781439035665 ppt ch09
9781439035665 ppt ch09Terry Yoast

datastructureppt-190327174340 (1).pptx
datastructureppt-190327174340 (1).pptxDEEPAK948083

## Similar to How do arrays compare with variables and how do they differ- Give a si.docx

### Similar to How do arrays compare with variables and how do they differ- Give a si.docx(20)

Data structure array
Data structure array

Data structure ppt
Data structure ppt

Data structures in c#
Data structures in c#

1 D Arrays in C++
1 D Arrays in C++

Data structure.pptx
Data structure.pptx

arrays.pptx
arrays.pptx

Lecture 15 - Array
Lecture 15 - Array

Array
Array

DSA Unit II array.pptx
DSA Unit II array.pptx

Chapter 13.pptx
Chapter 13.pptx

Learn Java Part 8
Learn Java Part 8

1st lecture.ppt
1st lecture.ppt

C++ arrays part1
C++ arrays part1

Arrays in JAVA.ppt
Arrays in JAVA.ppt

02 arrays
02 arrays

DATA STRUCTURE CLASS 12 COMPUTER SCIENCE
DATA STRUCTURE CLASS 12 COMPUTER SCIENCE

Data Structure.pptx
Data Structure.pptx

OOPs with java
OOPs with java

DS Complete notes for Computer science and Engineering
DS Complete notes for Computer science and Engineering

## More from tpaula2

How can I calculate the missing amounts for each of the independent ca.docx
How can I calculate the missing amounts for each of the independent ca.docxtpaula2

How do COQ and capability relate-SolutionBorn 130 years ago- Le coq sp.docx
How do COQ and capability relate-SolutionBorn 130 years ago- Le coq sp.docxtpaula2

How do --per capita-- considerations affect a company-'s decision to e.docx
How do --per capita-- considerations affect a company-'s decision to e.docxtpaula2

How do I calculate the limiting reagent and percent yield for creating.docx
How do I calculate the limiting reagent and percent yield for creating.docxtpaula2

How can you classify the molecular structures of the polymers- Explain.docx
How can you classify the molecular structures of the polymers- Explain.docxtpaula2

How could I show that the nitrate test confirmed that two unknown solu.docx
How could I show that the nitrate test confirmed that two unknown solu.docxtpaula2

how can you determine if a computer is using pipelining-SolutionIn old.docx
how can you determine if a computer is using pipelining-SolutionIn old.docxtpaula2

How do changes in activity affect contribution margin and net operatin.docx
How do changes in activity affect contribution margin and net operatin.docxtpaula2

How do convert strings inside a vector to integers and then find the a.docx
How do convert strings inside a vector to integers and then find the a.docxtpaula2

How can the use of Internet search engines to locate information about.docx
How can the use of Internet search engines to locate information about.docxtpaula2

How can the forms of business organizations impact the control of the.docx
How can the forms of business organizations impact the control of the.docxtpaula2

how can i store 30 prices on this void get prices and save it to the a.docx
how can i store 30 prices on this void get prices and save it to the a.docxtpaula2

How can a company assess person-job fit before hiring employees What a.docx
How can a company assess person-job fit before hiring employees What a.docxtpaula2

How can biometric technology be used to fight cybercrime and cyber rel.docx
How can biometric technology be used to fight cybercrime and cyber rel.docxtpaula2

How can CORS be used to exploit the following password reset page- The.docx
How can CORS be used to exploit the following password reset page- The.docxtpaula2

How are encryption- authentication- digital signatures- and digital ce.docx
How are encryption- authentication- digital signatures- and digital ce.docxtpaula2

How are cash equivalents treated on a statement of cash flows- They ar.docx
How are cash equivalents treated on a statement of cash flows- They ar.docxtpaula2

home - study - science - physics - physics questions and answers - an.docx
home - study - science - physics - physics questions and answers - an.docxtpaula2

HOME -NSERI PAGE LAYOUT FORMULAS DATA REVEW VIPw Cut Copy Farnat Paint.docx
HOME -NSERI PAGE LAYOUT FORMULAS DATA REVEW VIPw Cut Copy Farnat Paint.docxtpaula2

Horizontal Analysis The comparative accounts payable and long-term deb.docx
Horizontal Analysis The comparative accounts payable and long-term deb.docxtpaula2

### More from tpaula2(20)

How can I calculate the missing amounts for each of the independent ca.docx
How can I calculate the missing amounts for each of the independent ca.docx

How do COQ and capability relate-SolutionBorn 130 years ago- Le coq sp.docx
How do COQ and capability relate-SolutionBorn 130 years ago- Le coq sp.docx

How do --per capita-- considerations affect a company-'s decision to e.docx
How do --per capita-- considerations affect a company-'s decision to e.docx

How do I calculate the limiting reagent and percent yield for creating.docx
How do I calculate the limiting reagent and percent yield for creating.docx

How can you classify the molecular structures of the polymers- Explain.docx
How can you classify the molecular structures of the polymers- Explain.docx

How could I show that the nitrate test confirmed that two unknown solu.docx
How could I show that the nitrate test confirmed that two unknown solu.docx

how can you determine if a computer is using pipelining-SolutionIn old.docx
how can you determine if a computer is using pipelining-SolutionIn old.docx

How do changes in activity affect contribution margin and net operatin.docx
How do changes in activity affect contribution margin and net operatin.docx

How do convert strings inside a vector to integers and then find the a.docx
How do convert strings inside a vector to integers and then find the a.docx

How can the use of Internet search engines to locate information about.docx
How can the use of Internet search engines to locate information about.docx

How can the forms of business organizations impact the control of the.docx
How can the forms of business organizations impact the control of the.docx

how can i store 30 prices on this void get prices and save it to the a.docx
how can i store 30 prices on this void get prices and save it to the a.docx

How can a company assess person-job fit before hiring employees What a.docx
How can a company assess person-job fit before hiring employees What a.docx

How can biometric technology be used to fight cybercrime and cyber rel.docx
How can biometric technology be used to fight cybercrime and cyber rel.docx

How can CORS be used to exploit the following password reset page- The.docx
How can CORS be used to exploit the following password reset page- The.docx

How are encryption- authentication- digital signatures- and digital ce.docx
How are encryption- authentication- digital signatures- and digital ce.docx

How are cash equivalents treated on a statement of cash flows- They ar.docx
How are cash equivalents treated on a statement of cash flows- They ar.docx

home - study - science - physics - physics questions and answers - an.docx
home - study - science - physics - physics questions and answers - an.docx

HOME -NSERI PAGE LAYOUT FORMULAS DATA REVEW VIPw Cut Copy Farnat Paint.docx
HOME -NSERI PAGE LAYOUT FORMULAS DATA REVEW VIPw Cut Copy Farnat Paint.docx

Horizontal Analysis The comparative accounts payable and long-term deb.docx
Horizontal Analysis The comparative accounts payable and long-term deb.docx

Permeation enhancer of Transdermal drug delivery system
Permeation enhancer of Transdermal drug delivery systemchetanpatil2572000

Odontogenesis and its related anomiles.pptx
Odontogenesis and its related anomiles.pptxMennat Allah Alkaram

Unit 5th topic Drugs used in congestive Heart failure and shock.pdf
Unit 5th topic Drugs used in congestive Heart failure and shock.pdfSUMIT TIWARI

Mycobacteriology update 2024 Margie Morgan.ppt
Mycobacteriology update 2024 Margie Morgan.pptMargie Morgan

BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...Nguyen Thanh Tu Collection

EmpTech Lesson 7 - Online Creation Tools, Platforms, and Applications for ICT...
EmpTech Lesson 7 - Online Creation Tools, Platforms, and Applications for ICT...liera silvan

A TEXTBOOK OF INTELLECTUAL ROPERTY RIGHTS
A TEXTBOOK OF INTELLECTUAL ROPERTY RIGHTSDr.M.Geethavani

A LABORATORY MANUAL FOR ORGANIC CHEMISTRY.pdf
A LABORATORY MANUAL FOR ORGANIC CHEMISTRY.pdfDr.M.Geethavani

Successful projects and failed programmes – the cost of not designing the who...
Successful projects and failed programmes – the cost of not designing the who...Association for Project Management

Ideotype concept and climate resilient crop varieties for future- Wheat, Rice...
Ideotype concept and climate resilient crop varieties for future- Wheat, Rice...AKSHAYMAGAR17

BIOCHEMICAL PROPERTIES OF WATER .Raveesh.pptx

How To Create Record Rules in the Odoo 17
How To Create Record Rules in the Odoo 17Celine George

SSC Hindu Religion and Moral Education MCQ Solutions 2024.pdf
SSC Hindu Religion and Moral Education MCQ Solutions 2024.pdfMohonDas

Digital Footprints to Career Pathways - Building a Strong Professional Online...
Digital Footprints to Career Pathways - Building a Strong Professional Online...Sue Beckingham

Dr.M.Florence Dayana-Cloud Computing-unit - 4.pdf
Dr.M.Florence Dayana-Cloud Computing-unit - 4.pdfDr.Florence Dayana

Genetics, Heredity, Variation, history, its roles, Scope, Importance, and Bra...
Genetics, Heredity, Variation, history, its roles, Scope, Importance, and Bra...AKSHAYMAGAR17

Discussing the new Competence Framework for project managers in the built env...
Discussing the new Competence Framework for project managers in the built env...Association for Project Management

Mycology Update February 2024 Microbes with Morgan
Mycology Update February 2024 Microbes with MorganMargie Morgan

Permeation enhancer of Transdermal drug delivery system
Permeation enhancer of Transdermal drug delivery system

Odontogenesis and its related anomiles.pptx
Odontogenesis and its related anomiles.pptx

Unit 5th topic Drugs used in congestive Heart failure and shock.pdf
Unit 5th topic Drugs used in congestive Heart failure and shock.pdf

Mycobacteriology update 2024 Margie Morgan.ppt
Mycobacteriology update 2024 Margie Morgan.ppt

BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...

EmpTech Lesson 7 - Online Creation Tools, Platforms, and Applications for ICT...
EmpTech Lesson 7 - Online Creation Tools, Platforms, and Applications for ICT...

A TEXTBOOK OF INTELLECTUAL ROPERTY RIGHTS
A TEXTBOOK OF INTELLECTUAL ROPERTY RIGHTS

A LABORATORY MANUAL FOR ORGANIC CHEMISTRY.pdf
A LABORATORY MANUAL FOR ORGANIC CHEMISTRY.pdf

Successful projects and failed programmes – the cost of not designing the who...
Successful projects and failed programmes – the cost of not designing the who...

Ideotype concept and climate resilient crop varieties for future- Wheat, Rice...
Ideotype concept and climate resilient crop varieties for future- Wheat, Rice...

BIOCHEMICAL PROPERTIES OF WATER .Raveesh.pptx
BIOCHEMICAL PROPERTIES OF WATER .Raveesh.pptx

How To Create Record Rules in the Odoo 17
How To Create Record Rules in the Odoo 17

SSC Hindu Religion and Moral Education MCQ Solutions 2024.pdf
SSC Hindu Religion and Moral Education MCQ Solutions 2024.pdf

Digital Footprints to Career Pathways - Building a Strong Professional Online...
Digital Footprints to Career Pathways - Building a Strong Professional Online...

Dr.M.Florence Dayana-Cloud Computing-unit - 4.pdf
Dr.M.Florence Dayana-Cloud Computing-unit - 4.pdf

Genetics, Heredity, Variation, history, its roles, Scope, Importance, and Bra...
Genetics, Heredity, Variation, history, its roles, Scope, Importance, and Bra...

Discussing the new Competence Framework for project managers in the built env...
Discussing the new Competence Framework for project managers in the built env...

Mycology Update February 2024 Microbes with Morgan
Mycology Update February 2024 Microbes with Morgan

### How do arrays compare with variables and how do they differ- Give a si.docx

• 1. How do arrays compare with variables and how do they differ? Give a simple example (Programming Logic and Design) Solution Arrays : Array is a homogeneous (same kind of elements) collection of elements in memory in a contagious locations. The first element of array is stored at index =0 and last element is stored at index=size-1. For example, int marks [5] ={10,20,30,40,50}; 10 20 30 40 50 Variable : The variable is a name given to memory location in a computer memory. The element is stored in that memory location can be pointed by the variable name. For example, int id=10; Where id is a name given to the memory location where the value 10 is stored. Comparison of array elements with variables : Since arrays are stored index based, the elements are compared using index location of the element in an array. int min=50;
• 2. for(int i=0;i<5;i++) //comparison of array element with variable, min if(marks[index]==min) //code follows 10 20 30 40 50
Current LanguageEnglish
Español
Portugues
Français
Deutsche