I would like to use the ROOT prompt to educate undergraduate students and to tell them how pointes work in C/C++. In line [2] above, I would like to show the address of str + 2 instead of "loo". The automatic C string conversion in this case is too user friendly for my specific education purpose.
One possible workaround is casting to void*, while at this stage I have not told the students what cast is.
Q2. What is @0x7ffee1771f18 in this example? p1 and p2 are identical when compared with ==, but the two different output 0x1119c0658 and @0x7ffee1771f18 are seen.
Q1: I can’t think of a way without a cast, and while keeping them char*. printf might indeed be the best option.
Q2: @ signals that it’s an lvalue, and it shows the address of the lvalue reference - in this case the address of p2.