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
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…