I think the most important thing you can do is show them how to fix their own problems. There are so many threads on this site about interns or new workers or someone of that stature asking for help over every little issue. You also see the other side about young developers who just toil through and waste so much time because they refuse to ask for help.
The best way to help him is to show him resources. Tell him how you solve your problems. Talk about stack overflow, how to search google effectively, printf debugging, and stuff like that. Tell him that when he has an issue, he should basically go down this checklist and try to figure out what's going wrong and see if he can fix it, BUT that he shouldn't spend too much time on something potentially trivial. When he does come for help, make him tell you what all he's tried, what he figured out, and guide him from there.
When I was first starting programming, I learned a ton by trying to fix my errors. That's because oftentimes I'd try to fix "x" when my problem was really "y", but in the process I'd learn about both x and y. In the future, if I saw problems related to x or y, then I'd know where to go back to dig deeper. You pick up a lot just by reading, and by searching for answers, you can pick up what's wrong.
Just to reiterate an earlier point, show him how to use a debugger, or at least how to go through his code. To quote Alan Perlis:
To understand a program you must become both the machine and the program.
A lot of new programmers just stare at code trying to get an epiphany (turns out people try to solve a lot of problems this way), but that's unnecessary with the tools we have at our disposal. Tell him about how you read through a program and "imagine" it working, and help him think through his code. Show him how to either use a debugger, or how to insert print statements to confirm his understanding.
That'll put him way ahead of the curve. The rest will come with his own efforts.