foreach loop for c++ | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

foreach loop for c++

Is there a loop in C++ like foreach loop in C#?

17th Nov 2017, 3:30 PM
Mustafa K.
Mustafa K. - avatar
1 Resposta
+ 1
Yes, there is. Its called for_each(). www.cplusplus.com/reference/algorithm/for_each The C++ one uses iterators and a function, but cannot accept the container the iterators point to, unlike the C# version.
17th Nov 2017, 3:49 PM
Kinshuk Vasisht
Kinshuk Vasisht - avatar