I had a similar problem with hard lockups especially when doing package updates (Arch). After seeing a report on Gaming on Linux about the Nvidia 550 driver (I think it was that one) causing freezes, I uninstalled it and just ran on the intel igpu. Never had a single freeze again. Waited for 555 driver, installed that, and immediately got lockups during package updates (and randomly sometimes) again. I’ve now installed the nvidia-open package to see if it fixes it, and so far so good.
I like to use asterisk spacing.
void main() { /****/for (int i=0; i <10; ++I) { /********/printf("hello world\n"); /********/printf("%d\n", i); /****/} }