Hey everyone! I'm new to C++ and have been diving into concepts like linear search. I wrote some code, but I ended up with errors, and I couldn't figure out what went wrong. I decided to avoid looking at tutorials and just asked ChatGPT to help me out instead. Turns out, the issue was that I forgot to initialize the variable meant to store the output. So, I'm wondering, was this a huge, stupid error on my part, or is it just part of the learning curve?
2 Answers
You're definitely not alone. Simple mistakes like this can happen to anyone. If you're not already, consider setting the C++ warning level to maximum. It can help catch issues like uninitialized variables because the compiler would usually warn you about it. If you're writing on paper and can't see these warnings, just be extra careful when transferring to your phone.
This is totally normal for any programmer, not just beginners! The key isn't to write perfect code right away, but to learn how to debug issues when things don't go as planned. It's all part of the process!
The thing is... I haven't used my laptop for this... I'm in the library, so I just wrote code on paper and then on my phone to compile it. So no warnings showed up.