code–https://ide.codingblocks.com/s/386533
output–
a�
0x7ffe9b69b0fb
0x7ffe9b69b0fc
0x7ffe9b69b0fc
0x7ffe9b69b100
0x7ffe9b69b0fb
0x7ffe9b69b0ff
0x7ffe9b69b0fb
0x7ffe9b69b0ff
0x7ffe9b69b0fb
0x7ffe9b69b0fc
2.8026e-45
2
Sir, here is it by chance that the addresses of a and ch are consecutive
Doubt in pointers
above i have mentioned the output to the input 1 2
QUES–Sir, here is it by chance that the addresses of a and ch are consecutive
Hello @aaliyah_beg yes that address allocation is totally random. whenever you will run the code you will find different address.
if you have any doubt you can ask here:
Happy Learning!!
Sir in this case since the address alloted to ch is 0x7ffe9b69b0fb and that to a is 0x7ffe9b69b0fc which are consecutive so when we do–25th line of the code: cout<<((float)(chptr+1))<<endl; then shouldnt the value stored in variablea be printed
No i think it will be done in the different way.
you can check by performing this one ide.
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.