In below code I could not understand how
int x = 100;
int *ptr = & x;
auto test = ptr;
you can also ask the question "eventually, everything in my program is bytes, so why does
auto doesn't deduce everything to be
Well, it's simple. the type of
int* so the type of
test is also
int*. it doesn't matter how the generated assembly looks like. it may be that the cpu treats
unsigned int the same way, but that's irrelevant for C++, as C++ is a high level language.
besides that. the underlying statement that "a pointer is an unsigned int" is not true. pointer is a type that allows reading and writing to the memory address contained in that variable. an unsigned int is ... an unsigned int. nothing more, nothing less.