I have been teaching myself programming for couple of years, and I was sure that if you need array declaration of a variable number you need to use malloc or
malloc
No thats not safe at all. It could corrupt your stack.