Many "illegal" operations in C are 'not required to be diagnosed at [[compile time]], and can produce [[undefined behaviour'behavior]] at [[runtime|run time]]. This means that the exact behaviourbehavior which arises is not definedspecifed by the standard, and exactly what will happen does not have to be defineddocumented by the compilerC implementor. A famous, although misleading, expression in comp.std.c is that athe compiler cancould cause "demons to fly out of your nose". OftenSometimes in practice what happens withfor an instance of undefined behaviourbehavior is bugsa [[software bug|bug]] which areis hard to track down and causewhich may corrupt the contents of memory. Sometimes a particular compiler generates well-behaved actions that are not the same as would be obtained using a different C compiler. The main purpose of leaving some behavior undefined is to allow the compiler to generate more efficient executable code for well-defined behavior, which is important for C's primary role as a systems implementation language; it is the programmer's responsibility to avoid undefined corruptionbehavior. Examples of undefined behaviourbehavior are:
* Accessing outside the bounds of an array.
* Overflowing a signed integer.
* Reaching the end of a function whichwithout should returnfinding a valuereturn withstatement, findingwhen athe return statementvalue is used.
* Reading the value of a variable before writing to it.
These operations are all programming errors that could occur using many programming languages; C draws criticism because its standard explicitly identifies numerous cases of undefined behavior, including some where the behavior could have been made well defined, and does not specify any run-time error handling mechanism.