Question 180Asked in DSSSB TGT Computer Science, 25 Jun 2023, Shift 3 (4:30 PM)What is the main difference between a dynamic array and a static array in C programming?
- AStatic arrays are stored in the stack, while dynamic arrays are stored in the heap.
- BDynamic arrays can be resized during runtime, while static arrays have a fixed size.
- CStatic arrays can be resized during runtime, while dynamic arrays have a fixed size.
- DDynamic arrays are stored in the stack, while static arrays are stored in the heap.
Show answerHide answer
Correct answer: (B) Dynamic arrays can be resized during runtime, while static arrays have a fixed size.
Explanation
A static array's size is fixed at compile time. A dynamic array (created with malloc or realloc) can be resized at runtime.