Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * [sp.c]
- * A program that prints its stack pointer (on Linux).
- *
- *
- * compile with:
- * gcc -o sp sp.c
- */
- #include <stdlib.h>
- #include <stdio.h>
- unsigned long get_sp(void)
- {
- __asm__("movl %esp, %eax");
- }
- int main(void)
- {
- printf("0x%x\n", get_sp());
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment