Is this a general curiosity looking for a rule of thumb that mostly works or do you need to know with certainty? What language?
A simple rule of thumb for C/C++ could be that malloc/new/dynamically allocated variables are in heap and variables whose size is known at compile time and have local scope are stack. This is not strictly true, but it's simple and mostly true.
Depending on how much detail/special cases you want to get in to, it's possible for a variable to not be in or referencing/pointing to either the stack or heap. I'll leave scenarios where this may occur as exercise for the reader. ;)