Discussion
calloc initialises memory with all bits set to zero.
Answer: A
Correct answer: true
calloc sets every bit of the allocated block to zero, and the standard requires it. That is the guarantee, not a compiler-dependent convenience.
One subtlety is worth knowing: all-zero bits reliably give integer zero, but the standard does not promise that they give a null pointer or a floating-point zero - those hold on essentially every current implementation but are not guaranteed. Code depending on a zeroed block containing valid null pointers is portable in practice rather than in principle.
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