In C, an array like char buff[10] has valid indices from 0 to 9 — that's 10 elements. buff[10] is out of bounds — it's the 11th element, which does not exist.
'buff' is a 10 characters long string (from 0 to 9) and the user is trying to write the 11th position, which is over its last position. So the right answer is B. overflow
The answer is B (buffer overflow)
Reasons:
The buffer buff is defined to hold 10 elements (indices 0 through 9).
Writing to buff[10] attempts to access memory beyond the allocated buffer size.
This can lead to overwriting adjacent memory, potentially corrupting data, crashing the application, or enabling the execution of malicious code.
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Jasper_Ng
4 days, 3 hours agon19htf4ll
2 weeks agonicejob
2 months, 3 weeks agoOsanyindoro
3 months, 2 weeks agoBooict
3 months, 2 weeks agoBooict
3 months, 2 weeks ago