+ 6
Explaination needed for this code.
This is a code made by @harshit. But when some changes are done. I am not understanding why the answer is this. Could anyone explain. I have linked the code too. https://code.sololearn.com/clYC8LLBLEFq/#cpp
2 odpowiedzi
+ 9
Character pointers are special because they are treated as C-style strings by std::cout. It doesn't output the address stored by p in this case, it outputs the string starting from the first character it is pointing to. Whatever you are seeing in the output followed by 'b' are garbage values left behind in the memory addresses following the address of variable b.
+ 6
Thanks for explaining @Cool.