Static Memory Allocation
Static Memory Allocation is a method of allocating memory at compile time, meaning that the size and location of memory are determined before the program runs. This type of allocation is typically used for variables whose size is known and fixed, such as arrays or constants. Once allocated, the memory remains reserved for the entire duration of the program.
In C or C++, static memory allocation can be achieved using global variables or static variables within functions. This approach is efficient because it avoids the overhead of dynamic memory management, but it lacks flexibility, as the allocated memory cannot be resized during runtime.