Skip to content

Instantly share code, notes, and snippets.

@mlouielu
Last active October 23, 2018 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlouielu/3277952b821e0c77ddaaecc37e198db4 to your computer and use it in GitHub Desktop.
Save mlouielu/3277952b821e0c77ddaaecc37e198db4 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
int c = 0xffffeeee;
int main() {
int a = 0x12345678;
int b = 0xdeadbeaf;
int *d = malloc(sizeof(int));
int *e = malloc(sizeof(int));
printf("%p %p %p %p %p\n", &a, &b, &c, d, e);
}
/*
* On 4.13.0-17-generic #20-Ubuntu SMP x86_64
* $ gcc -O0 stack_heap.c
* $ ./a.out
* 0x7ffe0d98ebc0 0x7ffe0d98ebc4 0x5655196bb010 0x56551b553260 0x56551b553280
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment