C++ Programming Tutorial 58 – Range Based For Loop



Python Bootcamp – https://www.codebreakthrough.com/python-bootcamp

💯 FREE Courses (100+ hours) – https://calcur.tech/all-in-ones
🐍 Python Course – https://calcur.tech/python-courses

✅ Data Structures & Algorithms – https://calcur.tech/dsa-youtube

~~~~~~~~~~~~~~~ CONNECT ~~~~~~~~~~~~~~~

✉️ Newsletter – https://calcur.tech/newsletter
📸 Instagram – https://www.instagram.com/CalebCurry
🐦 Twitter – https://twitter.com/calebCurry
🔗 LinkedIn – https://www.linkedin.com/in/calebcurry
▶️ Subscribe – http://calcur.tech/subscribe
👨🏻‍🎓 Courses – https://www.codebreakthrough.com

~~~~~~~~~~~~~~ SUPPORT ME ~~~~~~~~~~~~~~

↪ My Amazon Store – https://www.amazon.com/shop/calebcurry
🅿 Patreon – http://calcur.tech/patreon-calebcurry
🅖 GitHub Sponsors – https://github.com/sponsors/CalebCurry
Ⓟ Paypal – http://paypal.me/calcur

🅑 Bitcoin – 3HnF1SWTzo1dCU7RwFLhgk7SYiVfV37Pbq
🅔 Eth – 0x350139af84b60d075a3a0379716040b63f6D3853
📈 Buy Bitcoin – https://calcur.tech/crypto
Reserve the Ruby Steel crypto rewards card and get a $25 bonus (use affiliate code “Caleb”) – https://calcur.tech/crypto

19 thoughts on “C++ Programming Tutorial 58 – Range Based For Loop

  1. Thank you so much. I'm just a few weeks into my self teaching and I was so utterly confused at the syntax and descriptions others have provided on this.
    You fixed it for me. 👍

  2. You can get the array printing function to work by dereferencing the pointer by changing void test(int data[]) to
    void test(int (&data)[size]) but yeah, you gotta specify how big should the dereferenced array be, which takes the whole advantage of ranged based loops, but who cares? who got it to work didn't we? 😛

  3. Hi Calab, in the last part when you try to call the basic C-style array, i cannot see how and where is the function test() is called because test() is not in `int main` anywhere…

  4. You can specify in the arguments of the function that you are passing a vector or array type like (std::vector<int> data) for use with the forange loop, in othe case you can also do (std::array<int, size> data) and you will also iterate with forange. I know the last example explanation is worthless because thats the point, not sending the size of an array by arguments, but I just want to show that it can be happen!. Thank Caleb! awesome videos I follow you everytime you upload a new video! Keep it going bro! I laught and enjoy every video!! thank you for all the patience and effort you put in to make those tutorials.. I'm from Paraguay by the way!! And I a cpp lover hahaha

Leave a Reply

Your email address will not be published. Required fields are marked *