codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#include <stdlib.h> #include <stdio.h> typedef struct { char x[6*16]; } s; int main() { s* a = (s*) malloc(sizeof(s)); malloc(16); s* b = (s*) malloc(sizeof(s)); int bytedist = (char*)b - (char*)a; int dist = b - a; printf("distance %td (%td bytes) pointer: %x mangled pointer: %x\n", dist, bytedist, (int) b, (int) (a + dist)); return 0; }
Private
[
?
]
Run code