asdrubael
asdrubael

Reputation: 483

Provoke a unhandled exception

I want to test a bunch of "application crash dump generators" like good old Dr. Watson.

What is the easiest way to provoke an application crash over a unhandled exception in C/C++?

Upvotes: 5

Views: 416

Answers (1)

Sergey Kalinichenko
Sergey Kalinichenko

Reputation: 726549

While technically dereferencing a NULL pointer is simply an undefined behavior, not a guaranteed crash, in practice it would crash with nearly absolute certainty:

(*((int*)0))=0;

Upvotes: 7

Related Questions