I come across a question in a coding competion
"write a code that returns SIGSEGV(Segmentation fault ) " .
Points were given on the basis of length of code. The prgramming languages available were asm,c,c++,java .
I knew c language better and submitted my code as
main(){char *c="h";c[3]='j';} But others solve it in shorter length than me . How it is possible ? Can any one explain plz.
Platform UBUNTU 10.04
int main() { std::cout << "SIGSEGV(Segmentation fault )" << std::endl; }\$\endgroup\$movl $0,0(GNU AS syntax, x86_64 - the modern assembly segfault) \$\endgroup\$std::cout << "SIGSEGV(Segmentation fault )\n";instead. :-) \$\endgroup\$