It seems you can confuse the conditions a bit.
Usually an object has an address. This is the location in memory where the object is located. Some temporary objects do not have addresses because they do not need to be stored. Such an exception is a temporary β4β object in the expression (2+2)*3
A pointer is an object that stores the address of another object. Therefore, for each type there is a corresponding pointer. int has int* , std::string has std::string* , etc.
Now you are writing about "pointer addresses". They exist. In the end, I wrote that a pointer is an object, and therefore it has its own address. And you can save this address in another pointer. For example, you can save the address and int* to int* * . But did you really intend to do this? Or did you mean "the address to which the pointer refers "?
Now you give height and weight as examples. The standard way to replace them with C ++ is simply std::swap(width, height) . Pay attention to std:: , which is a prefix for standard C ++ library functions. std::swap will replace almost everything. ints, floats, wives. (C / C).
You have another swap function, apparently. It takes two pointers to integers, which means that it wants the addresses of two integers. In this case, they are easy to provide. width is an integer, and &width is its address. This can be stored in the pointer argument int* a . Similarly, you can store the address &height in the int*b argument. By connecting it, you get a call swap(&width, &height);
How it works? The function swap(int*a, int*b) b) has two pointer address holding two integers in memory. So what he can do is [1] select a copy of the first integer, [2] copy the second integer to the memory where the first integer was, and [3] copy the first integer back to the memory, where the second integer. In code:
void swap(int *a, int *b) { int temp = *a;