Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

14
  • 8
    \$\begingroup\$ int main() { std::cout << "SIGSEGV(Segmentation fault )" << std::endl; } \$\endgroup\$ Commented Dec 24, 2011 at 22:00
  • 6
    \$\begingroup\$ movl $0,0 (GNU AS syntax, x86_64 - the modern assembly segfault) \$\endgroup\$ Commented Dec 24, 2011 at 22:04
  • 4
    \$\begingroup\$ The question really can't be answered without reference to a specific platform. There is, for example, no C code that is guaranteed to give a SIGSEGV on every platform. \$\endgroup\$ Commented Dec 24, 2011 at 22:05
  • 3
    \$\begingroup\$ @sehe: That'd be both faster and shorter if you would do std::cout << "SIGSEGV(Segmentation fault )\n"; instead. :-) \$\endgroup\$ Commented Dec 24, 2011 at 22:23
  • 2
    \$\begingroup\$ This is a question that has an answer. There is a shortest program that produces the desired result. I don't agree that it should've been closed. \$\endgroup\$ Commented Dec 24, 2011 at 23:49