Discussion
Specify the 2 library functions to dynamically allocate memory?
Answer: C
Correct answer: malloc() and calloc()
malloc and calloc are the two allocation functions in standard C. malloc takes a single total size and leaves the block uninitialised; calloc takes a count and an element size and zeroes the result.
The standard library also provides realloc to resize an existing block and free to release one, so four functions in all - but only two of them allocate fresh storage. The others named in the options are not standard C at all.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development