+ 2
Please explain me "a pointer on pointer?"
thanks in advance ..
7 Respostas
+ 15
you can look at array of arrays as well . so when you dont specify the length of an array you should use pointer, which points to its first element. So if you need array of arrays its pointer on pointer, as it is the first case and also plus one pointer for showing the first array. Im not sure I explained well but it is great example to look at. I hope I helped)
+ 11
A pointer can point to another pointer.
+ 7
I'll try to explain it with conceptualy similar examples from the real world:
Imagine a box that represents a variable.
Then you start pointing to that box with your finger - you are a pointer to that box as you know where the box is so you can use it (fill it with stuff, move it, empty it, burn it).
Now imagine a friend of yours that doesn't know where the box is but knos where you are so your friend points to you (pointer to a pointer) so if somebody says to your friend that a teddy bair should be put into a box he/she gives you the teddy (pointer dereferencing to get to the first pointer) and then you place the teddy into the box (seond pointer dereferencing to get to the variable - box - that can contain a value - teddy that could be an int or char).
This chain of pointer to pointers can be as long as you need it to be.
This is useful for cases where you want to switch things:
Variable can switch its values.
Pointer to that variable can switch between variables (point to variable a forst then to b - where a can be a hotel in europe while b is a hotel in america but they are both hotels).
Pointer to a pointer can switch between pointers (points first to x then to y where they are two different agencies pointing to hotels and you switch the one that points to the expensive hotel one for the one that points to a cheaper hotel so you can get the cheaper of the two while making a reservation across a middleman that knows where the hotel is).
+ 2
int a = 7;
int *a_ptr = &a;
int **ptr_ptr = &a_ptr;
take this scenario. It is obvious that a_ptr that contains the address of a will be stored at some place in the memory, so ptr_ptr is actually the pointer to the pointer a_ptr, because it holds the address of memory location where a_ptr is stored.
+ 1
hey everyone I need tips and try not to make it complicated because I am only 10 (age) and need followers whatever that does but I don't know I just started this app 2 days ago so I would really appreciate it if you follow me and give me some tips and starts cya! peace out!
+ 1
pointer is a variable which holding the address of another variable.
when the. address of variable hold by pointer through another pointer so that's call a pointer on pointer
+ 1
It is simply a pointer pointing to another pointer
or pointer storing the address of another pointer