Difference between for loop and the range based loop in C

0 votes
The distinction between a for loop and a for each loop in C++ is unclear to me.

I've studied various books and tutorials, but I haven't yet understood how for each loop differs.

Examples of arrays that I've seen appear to imply that for each loop iterates over all of the items at once.

Could it be the unique benefit a range-based loop possesses?
Jul 11 in C++ by Nicholas
• 5,020 points
15 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In C++

0 votes
1 answer

What is the difference between public, private, and protected inheritance in C++?

To begin answering that question, let me characterise member accessors in my own terms.  If you already know this, proceed to the section "next:". I'm aware of three types of accessors: public, protected, and private. Let: class Base { public: ...READ MORE

answered Jul 11 in C++ by Damon
• 4,960 points
31 views
0 votes
1 answer

What is the difference between operator overloading and operator overriding in C++?

Some people use the latter word to ...READ MORE

answered Aug 2 in C++ by Damon
• 4,960 points
16 views
0 votes
1 answer

C++ code file extension? What is the difference between .cc and .cpp [closed]

GNU GCC recognizes all of the following ...READ MORE

answered Jun 21 in C++ by Damon
• 4,960 points
17 views
0 votes
0 answers

What is the difference between Java and C++?

What is the difference between Java and ...READ MORE

Jul 22 in C++ by Nicholas
• 5,020 points
14 views
0 votes
0 answers

What is the difference between cout, cerr, clog of iostream header in c++? When to use which one?

I looked up the differences between cout, ...READ MORE

Jul 27 in C++ by Nicholas
• 5,020 points
7 views
0 votes
0 answers

Difference between 'struct' and 'typedef struct' in C++?

In C++, is there any difference between: struct Foo ...READ MORE

Aug 8 in C++ by Nicholas
• 5,020 points
13 views
0 votes
1 answer

What is the difference between ++i and i++?

To answer your question, the ++i will ...READ MORE

answered Feb 17 in Others by Aditya
• 7,300 points
45 views
0 votes
0 answers

Is hiding implementation detail Encapsulation or Abstraction?

I have seen some people defining abstraction ...READ MORE

May 6 in Java by narikkadan
• 11,280 points
149 views
0 votes
1 answer

Why would anyone use set instead of unordered_set?

Unordered sets must compensate for their O(1) ...READ MORE

answered Jun 1 in C++ by Damon
• 4,960 points
55 views
0 votes
1 answer

What is a smart pointer and when should I use one?

A smart pointer is similar to a ...READ MORE

answered Jun 2 in C++ by Damon
• 4,960 points
19 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP