C/C++
001 int main(int argc, char *argv[]) {
002 *((int*) 0) = 0;
003 return 0;
004 }
Java
001 public class NullPointer {
002 public static void main(String argv []) {
003 ((Object) null).getClass();
004 }
005 }
Mono/C#
001 class NullPointer {
002 static void Main() {
003 object o = null;
004 o.ToString();
005 }
006 }
Pascal
001 Program NullPointer;
002
003 Var
004 p : ^Integer;
005
006 Begin
007 p := nil;
008 p^ := 0;
009 End.
x86 Assembler
001 .global main
002
003 main:
004 movl $0x0,0x0
005 ret
Sparc Assembler
001 .global main
002
003 main:
004 ret
005 ld [%g0], %l0