What is the primary cause of memory leaks in a C program?
- Excessive memory fragmentation.
- Failure to free dynamically allocated memory.
- Incorrect use of the malloc function.
- Insufficient memory allocation.
The primary cause of memory leaks in a C program is the failure to free dynamically allocated memory using functions like free(). When you allocate memory but don't deallocate it properly, it leads to memory leaks.
Loading...
Related Quiz
- When using dynamic memory allocation for arrays, which standard library function is used to release the memory that was previously reserved?
- What is the return type of the strlen function in C?
- An array of structures in C allows you to store multiple records, where each record can have ________ of different data types.
- What is the primary purpose of using typedef in C programming?
- In a program that processes large volumes of numerical data, which file format would be more efficient in terms of storage space and data retrieval speed?