Hard question (maybe)
-
typedef string *ptrstr; const ptrstr cstr;
//this is wrong What is the type ofcstr
? What underlying type does a pointerconst ptrstr
represent? Not a question, more in the form of a quiz. They say most progammers interperate this wrong. -
typedef string *ptrstr; const ptrstr cstr;
//this is wrong What is the type ofcstr
? What underlying type does a pointerconst ptrstr
represent? Not a question, more in the form of a quiz. They say most progammers interperate this wrong.Yeah, most programmers will really "interperate", especially those who post such questions. ;P
-
typedef string *ptrstr; const ptrstr cstr;
//this is wrong What is the type ofcstr
? What underlying type does a pointerconst ptrstr
represent? Not a question, more in the form of a quiz. They say most progammers interperate this wrong.#hackC++ wrote:
typedef string *ptrstr; const ptrstr cstr; //this is wrong What is the type of cstr ? What underlying type does a pointer const ptrstr represent?
Somebody please ask #hackC++ to use this way to get his answer by:
std::cout << typeid(cstr).name();
Maxwell Chen
-
typedef string *ptrstr; const ptrstr cstr;
//this is wrong What is the type ofcstr
? What underlying type does a pointerconst ptrstr
represent? Not a question, more in the form of a quiz. They say most progammers interperate this wrong.#hackC++ wrote:
What is the type of cstr ?
It is a
const ptrstr
, but it will need to be initialized.#hackC++ wrote:
Not a question, more in the form of a quiz.
How can it not be a question if it ends with a question mark?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
-
#hackC++ wrote:
typedef string *ptrstr; const ptrstr cstr; //this is wrong What is the type of cstr ? What underlying type does a pointer const ptrstr represent?
Somebody please ask #hackC++ to use this way to get his answer by:
std::cout << typeid(cstr).name();
Maxwell Chen
Looks like he has just discovered C++ for himself and it thrills him...
-
#hackC++ wrote:
What is the type of cstr ?
It is a
const ptrstr
, but it will need to be initialized.#hackC++ wrote:
Not a question, more in the form of a quiz.
How can it not be a question if it ends with a question mark?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
-
my grammer and english is not what you call "good". bare with me. please. string *const cstr; is the correct way. -- modified at 14:56 Tuesday 25th April, 2006
I think David is he not she, so he would not want to bare with you. :-D
-
my grammer and english is not what you call "good". bare with me. please. string *const cstr; is the correct way. -- modified at 14:56 Tuesday 25th April, 2006
#hackC++ wrote:
string *const cstr; is the correct way.
You wanted to know what
cstr
was, notptrstr
.cstr
is aconst ptrstr
, whileptrstr
is astring*
. In any case, you are mistaken. Whileconst string *cstr
andstring const *cstr
are interchangeable,string* const cstr
is completely different.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb