int a = 10;
int *ptr = &a;
cout << ptr <<endl;
o/p = 0x7fff15e4efd4
How come an integral pointer ptr store an address containing character ?
int a = 10;
int *ptr = &a;
cout << ptr <<endl;
o/p = 0x7fff15e4efd4
How come an integral pointer ptr store an address containing character ?
hi @aggarwal.naman21
Pointer stores the address of the variable… and int *ptr means that ptr is a pointer pointing to an integer variable… int in front of it doesn’t specify that it’s integer variable…
like i thought that if the address is say 0x7fff15e4efd4 , i.e it is a hexadecimal, so we can only see characters from a to f (representing nos form 10 to 15) , so it is an alternate way of representing numbers from 10 to 15 through alphabets .
am I right about it?
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.