Why isn't a missing null printing junk?

I’m working through the C book and am currently on Ex17. In trying to break the program, I remove NULs wherever possible to see what happens. Of course, it compiles without a problem. When I run the program, it doesn’t print any random junk where the null was removed. It looks like I never took out the null at all. GDB prints out a bunch of stuff about various files not existing – vprintf.c in particular – but that seems to happen with or without errors (that’s another question – what’s that all about?) At the end, GDB prints out that everything ran fine and exited normally. How is that possible? Curious to know about this sort-of-magic.

I’m running an Ubuntu (18.04 if that matters) VM on a Win10 host machine.

A lot of times it depends on where the string is setup in RAM, so many times there’s already a 0 there in the memory rather than some other junk. This means you run a C string without the NUL terminator all the time, and then maybe one day on a different computer or somewhere else it blows up without you realizing it. Try shuffling the order of the declarations around and then remove the NUL. Also, if you want to see it crash try just going through the string with a while loop and attempt to change characters ignoring the NUL.