2
Contributors
5
Replies
24
Views
4 Years
Discussion Span
Last Post by costy.bogdan
0

in the cout statement, there are two missing stars *, one befoe the first & and one before the second.

0

Is this what you meant?

char[10] arr="torino";
char* ptr;
ptr=arr;
cout << *&*&ptr;

Also, this looks like C++. Next time, post it in the C++ forum :)

Edited by Moschops

0

I'm glad that you find my typo, that I've also specified in a reply, this is my first post. If you can help me understand, I will be glad. :)

0

ptr is an object of type char*.
&ptr is a pointer to the object ptr, so an object of type char** (pointer to a char pointer)
*&ptr is the object that &ptr is pointing to, so it's ptr again.
So *&*&ptr is the same as *&ptr.
Do that again, and it's clear that *&*&ptr is the same as ptr

So cout << *&*&ptr; is the same as cout << ptr;

Is that clear?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.