|
| 11 Jul 2016 01:13 AM |
coming from Java I don't understand where you use -> instead of .
I've written C code for a while (less so C++), still don't quite understand this all the way and only used -> when compiler spits out an error or where something's gone wrong
Explain, please? |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2016 01:17 AM |
Say you have a pointer to a struct/class and you want to get a field from the pointer, instead of doing (*ptr).field you can do ptr->field
|
|
|
| Report Abuse |
|
|
| |
|
|
| 11 Jul 2016 01:18 AM |
ninja'ed
disregard other post I'm newish to pointers, and haven't used them in a while. |
|
|
| Report Abuse |
|
|
Everesty
|
  |
| Joined: 08 Oct 2009 |
| Total Posts: 6156 |
|
|
| 11 Jul 2016 01:18 AM |
stackoverflow/a/1238643
extremely minimum tl;dr: arrow when working with pointers, dot otherwise. |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2016 01:19 AM |
Here's an example OP: class Example { public: int value; };
Example* NewExample(int initial) { Example *example = new Example; example->value = initial; return example; }
int main() { Example *Hi = NewExample(123); std::cout << Hi->value << "\n"; return 0; }
// 123 |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2016 01:20 AM |
"are you using CLR?" You're an idiot. |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2016 01:25 AM |
@Flux
I said to disregard my other post, obviously you can't read well enough.
Whose the idiot now? |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2016 01:25 AM |
| You. Because you don't know anything. |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2016 01:27 AM |
@Flux
I do know something
.99 repeating != 1 |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2016 01:27 AM |
| Except that it does, you're stupid. |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2016 01:28 AM |
Except it doesn't.
Your brain obviously can't comprehend anything of the sort. |
|
|
| Report Abuse |
|
|
Everesty
|
  |
| Joined: 08 Oct 2009 |
| Total Posts: 6156 |
|
| |
|
|
| 11 Jul 2016 01:31 AM |
Because .111 repeating disappear's.
In a infinite sense it is not equivalent to 1. |
|
|
| Report Abuse |
|
|
Everesty
|
  |
| Joined: 08 Oct 2009 |
| Total Posts: 6156 |
|
|
| 11 Jul 2016 01:36 AM |
"Because .111 repeating disappear's."
........................?
0.1111... is just 1/9. It doesn't disappear, it stays right where it is, somewhere between 0.1 and 0.2.
"In a infinite sense it is not equivalent to 1."
Considering 0.9999... can't be thought of without the concept of infinity, it is equal to 1 in an infinite sense. |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2016 01:36 AM |
No it's not.
To put it quite simply, your incorrect. |
|
|
| Report Abuse |
|
|
Everesty
|
  |
| Joined: 08 Oct 2009 |
| Total Posts: 6156 |
|
|
| 11 Jul 2016 01:51 AM |
Oh yes, you're right, all those many mathematicians who actually do math as their life are definitely wrong.
Educate yourself before spewing ideas you haven't even considered thinking about around.
youtube/watch?v=TINfzxSnnIE |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2016 01:56 AM |
x = .9999999999999... 10x = 9.999999999999999... 10x - x = 9.9999999999999999... - 0.9999999999999999999... 9x = 9 x = 1
.999... = 1 |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2016 01:57 AM |
ty ty ty
that makes sense now
|
|
|
| Report Abuse |
|
|
Aethex
|
  |
| Joined: 16 Oct 2011 |
| Total Posts: 2193 |
|
|
| 11 Jul 2016 02:00 AM |
| you can trust everesty because he's actually calvin klein |
|
|
| Report Abuse |
|
|
Everesty
|
  |
| Joined: 08 Oct 2009 |
| Total Posts: 6156 |
|
|
| 11 Jul 2016 02:02 AM |
| Can confirm, I am indeed Mr. Klein himself. |
|
|
| Report Abuse |
|
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 11 Jul 2016 02:39 AM |
I find this sentence hilarious:
"Whose the idiot now?" |
|
|
| Report Abuse |
|
|
| |
|