The address 0x0 is not stack’d malloc’d c++ is a popular programming language which attempts to define a stack-based memory allocation scheme. The stack is a set of memory locations, one of which may be set to point to a value, while another of which may be set to point to an address, and so on. The idea is that a programmer can specify the memory addresses they want from the stack, and the program will know how to allocate memory for the memory addresses.
C is a good first-rate programming language, but it is not an object-oriented language. If you see a structure on the stack and want to know how to add an element to it, you need to be able to tell the program how to allocate the memory for the stack. For example, if you think of C as a stack, you need to know how to add a value to the stack, or at least the memory for the stack.
To find out how to do that, you first need to know what you want to do. This is what I meant when I mentioned that the program will know how to allocate memory for the stack. To find out what that is, you first need to declare a variable called stack. This is what you will declare and initialize to point to the memory address where you want to store an element to the stack.
You can of course access this memory as a variable, however there is a limit to what you can. If you declare it to the left of the variable, then it won’t be stored at all. If you declare it to the right of the variable, then it will be stored at the same location as you use to initialize it.
stack is a pointer to a memory location. So when you’re saying stack, you are actually saying, “give me an address that is at the same location as the variable you are talking about.” But that address will not be at the same location as the variable you are talking about, and will be a memory location that is just above the variable you are talking about.
But the value you are passing will be the address of your memory location that you are talking about, and not the address of the variable you are talking about. That is why it is not stack’d. It is a pointer to the same memory address.
What is Stackd? That’s a pointer to a pointer to the address of the variable you are talking about, not a pointer to a pointer to the variable you are talking about. Do you remember the address of the variable you are talking about? I don’t. (If you do, you can check the address below the variable.
The address of the variable you are talking about is 0x0 or address 0x0 in hex. Since you are asking about the address of the memory location, not the variable you are talking about, you are not talking about a malloc’d memory location.
The question is, who is the pointer? The person that you are asking is 0x0. It does not matter if the person that you are asking is 0x0 or 0x0 or 0x0. All you need to do is to change the pointer to 0x0 to 0x0 or 0x0 to 0x0. The trick is to ensure that the memory location of the memory address is 0x0.