answersLogoWhite

0


Best Answer

Loops can be used to iterate or walk through an array. For example, suppose you have an array already initialized (we'll call it "array"):

int target = -1;

for (i=0; i < array.length(); i++){

if (array[i] = target){

//do something

}

}

Here, we will walk through an array (note that arrays are zero indexed) using a loop to make sure we hit each element of the array. In our loop, we start at the head (or first element) and iterate over each element.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

Absolutely. In fact, using loops to process arrays is one the most fundamental paradigms in programming.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How can loops be used to process arrays?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How can loops be used to process arrays give examples?

How_can_loops_be_used_to_process_arrays


Can arrays be used in for loops?

yes


What are the basic parts of the c language?

That would include header files, data types, loops, functions, pointers, arrays


What is difference between Bac arrays and DNA arrays?

BAC (Bacterial Artificial Chromosome) arrays are a type of DNA arrays. BAC arrays are usually used for a technique called array CGH (Comparative Genomic Hybridisation) which is used to identify gross deletions or amplifications in DNA (which for example is common in cancer). DNA arrays include BAC arrays but also oligo, cDNA, and promoter arrays. Oligo and cDNA arrays are typically used for gene expression analysis (looking to see how heavily expressed each gene is). Oligo arrays can also be used for SNP (single nucleotide polymorphism) analysis. Promoter arrays are used to identify transcription factor binding sites.


Can you use the loops and arrays together?

Yes. int main(void){ int a[10]; int i=0; while(i&lt;10 &amp;&amp; a[i++]=i); return 0; }


How can arrays be used for inter function communication?

The size of a function can be determined from the size of the array. Arrays and functions are both used in computer programming.


What kind of negative loops are used to regulate chemical pathways?

Negative Feedback Loops


How can the word loops be used in a sentence?

Her garden appeared to be edged with loops of wrought iron.


Why are matrices used for representation while programming?

Let me correct you: two-dimensional arrays are used in programming to represent matrices. (Matrices are objects of mathematics, arrays are objects of programming.)


What are the loops on the floor of a transit van called?

The loops on the floor of a transit van are called loop anchors. The loops are used to safely secure wheelchairs in the van.&Ecirc;


What are loops in C?

In very simple terms, Loops in any language are used to perform a task repetitively.


Why you use Loops?

Loops are used to repeat the execution of the same set of instructions again and again in a program.