Don't miss an insight. Subscribe to Techopedia for free.


Undefined Behavior

What Does Undefined Behavior Mean?

In computer science, undefined behavior happens when a computer language does not handle a certain operation that is coded into a codebase. Some experts describe this as “assumptions made by translators of a source code,” suggesting that when there is not a procedure for a certain syntax, that leads to a problem that is hard to predict in terms of its resolution.


Techopedia Explains Undefined Behavior

Undefined behavior can take many forms. As mentioned, it occurs when some type of problem or operation is not built into the language that a programmer is using. For example, C and C++ have their own range of undefined behaviors according to how the language was created. One common example of undefined behavior is a situation where a program indexes an array outside of its bounds. Other examples have to do with dividing numbers by zero, printing a null value, or pointing to some memory location that is not there. All sorts of bugs or glitches in a computer programming code can create various different kinds of undefined behavior that engineers and programmers need to look out for.


Related Terms