Intermediate
C++
Q59 / 100
What is undefined behavior in C++?
Correct! Well done.
Incorrect.
The correct answer is B) Code whose behavior the C++ standard does not define — the compiler may do anything, including crash, produce wrong results, or appear to work
B
Correct Answer
Code whose behavior the C++ standard does not define — the compiler may do anything, including crash, produce wrong results, or appear to work
Explanation
UB examples: signed integer overflow, null pointer dereference, out-of-bounds access. UB allows compilers to make optimizing assumptions that can break seemingly correct code.
Progress
59/100