What is the difference between static and dynamic memory allocation in C language?
A. Static memory allocation is done at compile time and dynamic memory allocation is done at run time
B. Static memory allocation is done using malloc() and free() functions and dynamic memory allocation is done using arrays and structures
C. Static memory allocation is fixed and cannot be changed and dynamic memory allocation can be changed as per the requirement
D. Both A and C
Answer:D
What is the difference between static and dynamic memory allocation in C language?
A. Static memory allocation is done at compile time and dynamic memory allocation is done at run time B. Static memory allocation is done using malloc() and free() functions and dynamic memory allocation is done using arrays and structures C. Static memory allocation is fixed and cannot be changed and dynamic memory allocation can be changed as per the requirement D. Both A and C
Explanation: Arrays and structures are used at compile time to allocate static memory. The amount of memory allotted is fixed and cannot be altered while the program is running. Using the malloc(), calloc(), realloc(), and free() functions, dynamic memory allocation is carried out at runtime. While the program is running, the size of the memory allocation can be changed as needed.