Because using an invalid pointer invokes undefined behavior. And that means that the behavior is… well… undefined. It’s not obliged to crash.
More Related Contents:
- what the output of this code and why?
- printf anomaly after “fork()”
- How to make child process die after parent exits?
- What is time_t ultimately a typedef to?
- What is the equivalent to Posix popen() in the Win32 API?
- How to recursively list directories in C on Linux?
- Why does this program print “forked!” 4 times?
- How does kernel get an executable binary file running under linux?
- Measure time in Linux – time vs clock vs getrusage vs clock_gettime vs gettimeofday vs timespec_get?
- stdout thread-safe in C on Linux?
- Is malloc/free a syscall or a library routine provided by libc?
- Signal handling with multiple threads in Linux
- Best way to invoke gdb from inside program to print its stacktrace?
- How to include needed C library using gcc?
- Unexpected exec permission from mmap when assembly files included in the project
- Whole one core dedicated to single process
- Finding out what the GCC include path is [duplicate]
- Bind failed: Address already in use
- Why do I have to define LD_LIBRARY_PATH with an export every time I run my application?
- Is there a macro definition to check the Linux kernel version?
- Writing to a closed, local TCP socket not failing
- Write to .txt file?
- Do forked child processes use the same semaphore?
- What’s a good C decompiler? [closed]
- How to set the IP address from C in linux
- In C, what’s the size of stdout buffer?
- What API do I call to get the system uptime?
- Where are syscalls located in glibc source
- multiple threads able to get flock at the same time
- How to know if a Linux system call is restartable or not?