Code Structure Advice

Thanks I will look at checking memory usage. And possibly try and eliminate string functions from my code if I can. The system isn't mission critical but I'm trying to improve, I'm a novice programmer, I can get things to work in a few languages but don't actually know them fluently enough to know what I'm doing wrong or what's a better way.