Discussion
This function offers the quickest way to determine whether two character sequences of the same known length match character for the character up to and including any null character in both.
Answer: C
Correct answer: memcmp()
memcmp() is the one to use when both lengths are known: it compares a fixed number of bytes and stops only at a difference, taking no interest in null characters - so nulls inside the data are compared like any other byte. strcmp and strncmp both stop at a terminating null, so neither compares “up to and including” it.
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