If this is your first language...good luck, there's a bit of a steep learning curve.
Anyway, I would focus on really learning about pointers and memory management. Don't just import someone's solution to do memory management until you have learned the ins and outs of doing it yourself.