I will answer this with a beginner-friendly approach. In C, every function has its own working area. When a function is called, this can also be main (), and working space is created, called an activation record. This activation record includes some local variables, return values, and some other information. It's like a temporary working environment. If the function did its job, for example, did some computation, it may return something and quits. After the function terminates, this returned thing should not depend on the memory place it is created. In your case, the array is a contiguous memory area, and it is created in the stack in your code. After the function quits, there is nothing in that address since it is cleaned. In other words, the activation record has been cleaned.
There are a couple of ways to achieve this goal:
Global array: This array would sit in the data segment of the memory and will stay there until the program quits. Every function will have access to this array (without needing it as a parameter).
Static keyword: Using static directly implies that you are putting this array into the data segment of your memory, and it will stay there until the program quits. However, static variables may be local (for example, if you use it in your getArray() function). There is a trick in the static keyword; if you use a function including a static keyword multiple times, the static variable is not initialized every time. You can skip that in other calls.
Heap: You need to understand pointers and dynamic memory allocation—research malloc(), NULL pointer, pointers, pointers-array relation, etc.