Undefined behavior is a characteristic of certain programming languages (most prominent in C and C++) to produce a result in certain situations that depends on compiler implementation or specified optimization switches. In other words, the specification does not define the language's behavior in all possible situations but states: "in case of the A condition, the result of B operation is undefined". It is considered a mistake to allow such a situation in your program even if it is executed correctly with some particular compiler. Such a program won't be a crossplatform one and may cause failures on a different computer, operating system and even with different compiler's settings.
You should not mix up undefined behavior with unspecified behavior, the latter being the case when the specification does allow not every behavior possible but a restricted range of implementation variants.
Below are examples of situations causing undefined behavior:
0