Computer Science, asked by pranjalsharma6477, 1 year ago

How does compiler allocate memory for variable length arrays in c?

Answers

Answered by CyberPhase
0

The C programming language manages memory statically, automatically, or dynamically. Static-duration variables are allocated in main memory, usually along with the executable code of the program, and persist for the lifetime of the program; automatic-duration variables are allocated on the stack and come and go as functions are called and return. For static-duration and automatic-duration variables, the size of the allocation must be compile-time constant (except for the case of variable-length automatic arrays). If the required size is not known until run-time (for example, if data of arbitrary size is being read from the user or from a disk file), then using fixed-size data objects is inadequate.

—————————————————-

Visit my YouTube Channel

bit.ly/cyberphase

Do subscribe

Similar questions