Question: I have often heard that C can crash spectacularly. Recently I got my first taste of this when a function I expected to return a string instead returned little happy faces. Since then I have been being more careful with initializing pointers and mallocing memory for arrays. Still, though, I have trouble believing that a program could crash THAT badly...

I guess it would depend on the scope of the program though? I mean, if a bug in a program that dealt with your fan copied happy faces into some important space in memory...?

My question is, how much myth is there in the world of spectacular C crashes? Can I get some concrete examples of dangerous things that one ought to avoid?

z.

Answer: 
C itself can't crash anything. Sloppy programming can crash everything.

The "happy faces" are an indication that your code corrupted memory. The only thing C had to do with that is the fact that you chose to use it. (And the fact your OS allowed it to happen is surprising - are you still running a version of DOS?)
Back when I was writing the Win98 drivers, the BSOD haunted everyone. I remember the following mistake I made

typedef struct \_SOME\_TAG\_ {

```
    int nSomeVar;
    int nSomeMore;
    ...

```

} MYSTRUCT, \*PMYSTRUCT;

....
 PMYSTRUCT pMyStruct;

// And I use this structure without allocating any memory ;-)
 pMyStruct->nSomeVar = 0;

And the driver crashes were so horrible but we had a SoftICE from Numega, Though it is only 10 years ago .. I feel its like ages back