Apparently you are confusing the pointer with the contents of the pointer.
As an analogue of the real world, you can say that by pointing to a bird you want to turn your index finger into a bird. But between the type of "bird" and "finger" there is no connection.
Passing this analogy into your program: you convert an object pointing to your int to int . Since the C pointer is implemented as a “memory cell number”, and since many memory cells are available, it is obvious that (int)p will result in a very large number.
Casting is an unpleasant thing. It is a coincidence that pointers are completely analogous to integers. If they were implemented as "n th the address of the memory bank m th ", you would not ask this question, because there would be no obvious relationship, and you would not be able to do this.
xtofl
source share