It's a scope issue.
You're getting compile error because this code is trying to use an undeclared variable, num, to declare the size of a global variable array. num doesn't exist at all at this point:
It's a problem later too, because if you do successfully declare the size of the arrays, that size is fixed. There'...