0 votes
in C Plus Plus by

How to get index of element in foreach loop

1 Answer

0 votes
by

Below is the code to get index of element when we are working on foreach loop

int z = 0;

foreach (Object i in collection)

{

// set of statements

// Some values

z++;

}

From above code we will get the value in variable z as index value

Related questions

0 votes
asked Jan 11 in C Plus Plus by GeorgeBell
0 votes
asked Oct 25, 2022 in Solr – Enterprise Search Engine by john ganales
...