Can not use "SP" variables as a stack pointer

I saw some one use variable name "SP" to print stack pointer.

like

Serial.print(SP)

and when I tried to use it,

I met error message

"SP was not declared in this scope".

I did not use it in any other function, but just in setup() or loop() function.

What did I wrong?

Thank you

(deleted)

spycatcher2k:
Post your FULL code, as it looks like you did not declare SP.

Yes, I did not declared SP.

What I am confused is,

as far as I know,

SP is reserved symbol for stack pointer.

so I did not need to declare.

SP was not declared should not come out as an error message, because it is already declared in other library file in arduino IDE.

mhyem2:
...because it is already declared in other library file in arduino IDE.

If that were true, you would not be getting the error....

Regards,
Ray L.

(deleted)

SP is defined on AVR boards, not necessarily on others.

Which board are you using?

oqibidipo:
SP is defined on AVR boards, not necessarily on others.

Which board are you using?

I am using Arduino Nano 33 BLE

Thank you,

then, is there any way to get stack pointer? like AVR boards?

What do you need it for? There may be an easy work-around.

If you do need to reference a machine register, use asm()...

aarg:
What do you need it for? There may be an easy work-around.

I just want to check stack pointers after function calls..

Thank you for all replies

mhyem2:
I just want to check stack pointers after function calls..

Yes, but why?

aarg:
Yes, but why?

To check stack region in SRAM of ARM cortex M4 which is a CPU of Arduino Nano 33 BLE?

I thought there must be a reserved region in SRAM for like function prarmeter and return address after procedure call except data and variables. and want to check that region.

Yeah, I don't mean to be a pest, but you have again avoided the main question, which is why you want to check that region?