c++ - memory location of pointer variable itself? -
Is it possible to have a Pointer Variable Storage Space?
i.e. I do not want to know the memory space, to point the pointer, I want to know what is the memory place of the pointer variable.
int A = 5; Int * k = & amp; A; Cout & lt; & Lt; K; will place me at a what is the place of k ?
int * k location of & amp; K , as such: // For this example assume that the variables start with 0x00 and 32 bits are each. Int A = 9; // 0x00 = 0x09 int * k = & amp; a; // 0x04 = 0x00 int ** k_2 = & amp; Amp; K; // 0x08 = 0x04 // like this: cout & lt; & Lt; "A value:" & lt; & Lt; a; // "The price of A: 9" Cot & lt; & Lt; "A's address:" & lt; & Lt; K; // "Address of: 0x00" cout & lt; & Lt; "Address of:" & lt; & Lt; K_2; // "Address of: 0x04" emphasis (A == * K); Emphasis (& amp; a ==); Emphasis (& amp; a == * k_2); Emphasis (A == ** k_2); By emphasis (K == * k_2); Emphasis (& amp; amp; k == k_2); A 32-bit pointer on 32-bit binary and 64 in 64, storing one memory address. Like any other variable, it has its own address, and the syntax is the same. For most intentions and purposes, indicators work like the same size as unsigned ent.
Now, when you call & amp; Amp; K , then you now have a int ** , with all the intriguing complications that go with to int ** k_2 = & Amp; Amp; K , * k_2 is k and ** k_2 is * k , then everything you do How does it work about expectations. This can be a useful way to create objects cross-library (pointers are basic and most secure passes) Double pointers are usually used in the interface, where you want to pass a pointer, Anyone who is filled with an object, but do not disclose how the object is being made (DirectX, for example).
Comments
Post a Comment