Print out value of stack pointer

One trick, which is not portable or really even guaranteed to work, is to simple print out the address of a local as a pointer. void print_stack_pointer() { void* p = NULL; printf(“%p”, (void*)&p); } This will essentially print out the address of p which is a good approximation of the current stack pointer