Someone I know wants to learn C, but run their own programs and exercises on a PC. Which is all well and good until we get to pointers. Is there a significant chance of them damaging the PC or crashing it?
Is there a significant chance of them damaging the PC or crashing it?
I'll ignore the "crashing" aspect (no, that's why we have process isolation) for now, and focus on what is on-topic for an EE.SE site:
Damage could only happen if you somehow made the hardware do something that damages it.
You won't be able to do that with a beginner's toolset. Sure, if you work as super user (a beginner wouldn't do that) and access a badly written driver (why would a beginner access a driver directly?) and instruct it to do something harmful (whatever that might be), yeah. There's potential for danger.
Remember, unless you're writing an early stage for your boot process, or a kernel component for your OS, you never access the raw memory of your machine, so accessing memory doesn't have side effects aside from the interfaces to hardware your OS offers you.
That's one of the many reasons one would recommend that people learn programming on a "proper" PC instead of on a microcontroller if they intend to deal with memory: The absence of hardware access makes everything safe, and way easier to debug.
In reality, I've never seen a beginner do beginner things that broke a PC. Like, I've seen people seriously torture keyboards in frustration, but that's not really the point here.
In a modern PC running a modern OS, there is virtually no chance of actually damaging anything (apart from the keyboard and their ego perhaps).
Errant programs (null dereference or file errors perhaps) will normally be not responding or terminated or perhaps give a segmentation fault.
One place to be careful is with files where some data might get lost or corrupted (and then usually only if you are using fwrite() or fread() with seek) but provided they are not system files (which are normally protected anyway) then it can be a valuable lesson.
File handling is actually a very important thing to learn, incidentally, particularly in C.
As noted by Marcus Muller this is not true when doing code on bare metal with a development kit. I have seen quite a few of those become door stops when the I/O pins are driven when they should not be.