Function pointer variables themselves are not all stack variables.
Example:
int ** p = new int*;
For this example, p is a pointer to a pointer, p is also a pointer, and p points to a memory block that stores an int value. However, the memory that stores the pointer variable *p itself is the heap.
It can be seen that pointer variables are the same as ordinary variables, they can be stack variables or heap variables.
What you said
函数内局部指针变量、指向动态申请的对象的局部指针变量
The pointer itself occupies memory space, and then it points to other memory spaces.
Yes, pointing to the heap address
Function pointer variables themselves are not all stack variables.
Example:
For this example, p is a pointer to a pointer, p is also a pointer, and p points to a memory block that stores an int value. However, the memory that stores the pointer variable *p itself is the heap.
It can be seen that pointer variables are the same as ordinary variables, they can be stack variables or heap variables.
Definitely not. Pointers are also variables, no different from other variables. Think about vector<int*>