Difference between revisions of "Talk:379: Forgetting"

Explain xkcd: It's 'cause you're dumb.
Jump to: navigation, search
Line 2: Line 2:
 
:Actually this works in C++ too. (*pointer).property is the same as pointer->property -- 17:58, 31 july 2013 (Time in Florida)
 
:Actually this works in C++ too. (*pointer).property is the same as pointer->property -- 17:58, 31 july 2013 (Time in Florida)
 
::Do you have a code snippet, maybe this could help me to explain this comic for non programmers.--[[User:Dgbrt|Dgbrt]] ([[User talk:Dgbrt|talk]]) 22:43, 31 July 2013 (UTC)
 
::Do you have a code snippet, maybe this could help me to explain this comic for non programmers.--[[User:Dgbrt|Dgbrt]] ([[User talk:Dgbrt|talk]]) 22:43, 31 July 2013 (UTC)
 +
:::At the moment I don't have a computer, just my phone, but I'll try (so i appologize for any typos in advance, you may correct them)
 +
pair<int, int>* pntr = make_pair(5, 8);
 +
cout << (*pntr).first << endl;
 +
cout << pntr->first << endl; // the same as above
 +
-- 22:12, 31 July 2013 (Florida)

Revision as of 02:13, 1 August 2013

The syntax for pointers in C++ is &pointer and *pointer. The arrow syntax is used e.g. in PHP. So this explain does need a review. And furthermore it should focus on the assert joke, understandable for non programmers.--Dgbrt (talk) 18:48, 31 July 2013 (UTC)

Actually this works in C++ too. (*pointer).property is the same as pointer->property -- 17:58, 31 july 2013 (Time in Florida)
Do you have a code snippet, maybe this could help me to explain this comic for non programmers.--Dgbrt (talk) 22:43, 31 July 2013 (UTC)
At the moment I don't have a computer, just my phone, but I'll try (so i appologize for any typos in advance, you may correct them)

pair<int, int>* pntr = make_pair(5, 8); cout << (*pntr).first << endl; cout << pntr->first << endl; // the same as above -- 22:12, 31 July 2013 (Florida)