Aside: It’s not about the code, it’s about the approach.
New coders will often times get wrapped up in “how can I code this in C” or “am I naming my variables the right way”. Unfortunately this approach leads to overthinking details that are all solvable and overtime they will become like muscle memory.
When you’re starting off you need to make sure that you fully understand the problem and have the steps needed to solve before you even start coding. A great way to practice this type of approach is by writing the problem and solution out on a piece of paper. Create a list of steps between the problem and solution then use those same steps to translate into code.
It’s rarely the case that the first solution is the best solution, so don’t even bother coming up with the perfect solution on the first run. Create a basic solution in the beginning then iterate on it to make it more robust / efficient.
Account for uncommon scenarios
The honest truth is that what you’re expecting a user to do when using your program is probably not encompassing what could happen. You need to account for all the possible scenarios so that when someone else uses your program they don’t get some unexpected results. This may seem like a small point considering all we’ve done so far is write “Hello world“ into the console, but it’s a critical part to coding and you should always keep this in mind whenever you’re thinking of a solution.