r/cs2a • • Jul 03 '24

Tips n Trix (Pointers to Pointers) Coding for Dummies

Hey all! I've been spending a lot of time over the past few days coding, as I'm sure you all have, and I wanted to drop a list of some tips that I find lead to the best results. Feel free to discuss in the comments or offer any of your own advice!

**1. DON'T START CODING IMMEDIATELY.**

This is really important. I have a tendency to code myself into a corner if I do this, or just forget what I'm doing halfway through. If you can, try grabbing a sheet of paper and writing out, in plain english, what you're trying to do.

For example, I'm trying to loop through this array. If the value matches one in my list, I want to replace it with this other value. If not, I'll return the original value. I want to pass the result to a variable and concatenate that with this string which is my output for the function.

**2. Learn how to learn.**

Google is your friend, but so is StackOverflow and so are books. I've been reading The C++ Programming Language by Bjarne Stroustrup, the creator of the language, and I love the way he explains things. I also watched through the FreeCodeCamp introduction to C++ on Youtube, which helped a lot.

Don't be afraid to ask for help on this forum either! Participation is required, so whether it's out of desire to help or desire for a grade, you *will* get responses.

**3. Write code!**

There's no substitute for just trying stuff out. Hack a prototype together and test it! Then do it again. Test edge cases and weird values. You should aim (in my opinion) to submit knowing that you'll get the points, rather than submitting over and over and correcting from there. Just don't forget to comment out your main()!

I'll amend this list as/when I think of more stuff, but again, feel free to discuss in the comments! Agree with what I've said? Disagree? I'd love to hear!

Happy coding :)

9 Upvotes

2 comments sorted by

2

u/diigant_srivastava Jul 03 '24

try grabbing a sheet of paper and writing out, in plain english

I also believe that writing pseudo code is important for beginners. It helps you understand what you are going to do before you do it. Having a reference point written in English that is digestible compared to the syntax of whatever programming language is chosen makes life much easier. Once you become experienced with programming and problem solving, it isn't necessary to write out the entire pseudo code, but I personally still make a mental checklist of how I will go about the task at hand.

And finally, nothing beats a good practice session. A website that I like is Leetcode. Though it is relatively advanced for me, there are some easy-level problems that I can try to solve. And now since I am learning a new language, C++, I will be revisiting those problems.

2

u/william_su Jul 04 '24

Adding on to what Shantanu and Diigant have already mentioned, understanding the problem and solving it in pseudo-code first is the most crucial step for beginners. Most beginners prefer to dive right in by writing code and spend most of their time debugging. By clearly planning out solutions, beginners will save time and headaches. After that step, it all comes down to becoming familiar with C++ syntax which comes naturally with practice :D