Query on keyword static

PLease explain how and when static works in detail.

Hello @prerak_semwal check this:
Static arrays are allocated memory at compile time and the memory is allocated on the stack. Whereas, the dynamic arrays are allocated memory at the runtime and the memory is allocated from heap. Stack have limited amount of memory but heaps have all the memory ur system can offer.A static variable can be thought of as a variable that is allocated in memory for the lifetime of during program execution. Even if it is used in a function that is called several times, the same memory space will be utilized for the static variable. The calculated value of this variable will be carried to the next function call too. The concept is useful for applications where the previous active state of a function is required. I never heard of dynamic variable unless we are considering it as a variable which is dynamically allocated.We allocate statically when we know the amount of memory required before execution of the program And we use dynamic allocation when we we don’t know the size of array or how much memory we will require