To allocate memory dynamically and initialize it to a specific value, the ________ function can be used in C.
- calloc()
- free()
- malloc()
- realloc()
In C, the "calloc()" function is used to dynamically allocate memory and initialize it to a specific value. It takes two arguments for the number of elements and the size of each element, allocating memory for an array.
Loading...
Related Quiz
- Why is it recommended to use pointer arithmetic instead of array indexing for traversal in some cases?
- How does function overloading in C++ enhance code readability and maintainability?
- What is the behavior of a union when different data types of different sizes are used?
- What is the time complexity of the linear search algorithm in the worst case?
- What is the purpose of command line arguments in a C program?