“Undefined behavior” is just that — undefined. The fact that it’s undefined makes “why is it doing that?” an invalid question.
More Related Contents:
- what does this expression mean "val&=val-1" [duplicate]
- function returns address of local variable, but it still compile in c, why?
- Access violation reading data from binary file into struct in C
- Writing a program without IF or :? conditional operator
- typedef struct vs struct definitions [duplicate]
- Why does scanf ask twice for input when there’s a newline at the end of the format string?
- What is the equivalent to getch() & getche() in Linux?
- sending blocks of 2D array in C using MPI
- Is it possible to iterate over arguments in variadic macros?
- Why do we need C Unions?
- What is the use of the %n format specifier in C?
- What is the use of the `inline` keyword in C?
- What is the fastest way to swap values in C?
- Macro returning the number of arguments it is given in C? [duplicate]
- Is there any way to change directory using C language?
- The difference of int8_t, int_least8_t and int_fast8_t?
- What is a contiguous memory block?
- Determine word size of my processor
- String input to flex lexer
- Comparing unsigned char and EOF
- AVX/SSE version of xorshift128+
- why does GCC __builtin_prefetch not improve performance?
- Unspecified number of parameters in C functions – void foo()
- How to print an unsigned char in C?
- String.indexOf function in C
- C – function returning a pointer to a local variable
- What does … mean in an argument list in C?
- C -> sizeof string is always 8
- Why doesn’t pressing enter return ‘\n’ to getch()?
- How can I call a function using a function pointer?