I wanted to know why printing the address of a variable in c gives the output as something like 823759733
while, doing the same in c++ shows 0x7ff6474009c??
Is this the work of ‘cout’, that formats the address as a hex? or is the variable memory address cloaked to show some arbitrary address to encapsulate it??
I know that everything is going on inside virtual memory in C++, is this the same for C?
int a=10; int* ptr=&a; printf("%d", ptr);
it should print an integer.
the same code written in c++
it shows a hex(I want to know why?)
Source: StackOverflow C++