HI,,
i have seen some prgorams use in the while loop this condition "->" , instead of "=>" .
what "->" does mean?
thanks
while loop"->"
Page 1 of 1
8 Replies - 489 Views - Last Post: 03 July 2008 - 01:52 PM
Replies To: while loop
#2
Re: while loop
Posted 02 July 2008 - 10:50 PM
I don't think that I've ever seen that used. Can you post an example?
I'm pretty sure, feel free to correct me, but you can't use a minus sign in the conditional. It's either greater than, less than, or equal to. The only combination being the equal to can be combined with either of the less than or greater than.
I'm pretty sure, feel free to correct me, but you can't use a minus sign in the conditional. It's either greater than, less than, or equal to. The only combination being the equal to can be combined with either of the less than or greater than.
#3
Re: while loop
Posted 02 July 2008 - 10:53 PM
My guess is that they are checking some member function of a pointer in the conditional of the while loop. If that makes sense... In other words:
while(somepointer->getValue())
This post has been edited by Einherjar: 02 July 2008 - 10:53 PM
#4
Re: while loop
Posted 02 July 2008 - 11:15 PM
Yeah thats what I was thinking too. Its all the -> operator is used for as far as I know.
#5
Re: while loop
Posted 03 July 2008 - 02:39 AM
It's used when you create a class pointer.
So, say you have a class SomeClass it would be created like:
SomeClass *p;
Then, instead of using . you would use -> like:
p->SomeFunction();
Another example is the this-> pointer, used in function definitions from within a class.
Hope this helps
So, say you have a class SomeClass it would be created like:
SomeClass *p;
Then, instead of using . you would use -> like:
p->SomeFunction();
Another example is the this-> pointer, used in function definitions from within a class.
Hope this helps
This post has been edited by gabehabe: 03 July 2008 - 02:41 AM
#6
Re: while loop
Posted 03 July 2008 - 07:30 AM
Excuse me, but what is => ?
Is it the same as >= ?
Is it the same as >= ?
#7
Re: while loop
Posted 03 July 2008 - 12:37 PM
#8
Re: while loop
Posted 03 July 2008 - 01:42 PM
Well, the -> operator is also used for structures in C/C++.
Example:
Example:
struct thisStruct{
bool value;
int trash;
}
thisStruct * Object;
while (Object->value==true); // OR just while (Object->value);
#9
Re: while loop
Posted 03 July 2008 - 01:52 PM
You could also like at it like so:
Let's say you have a struct or class called Record.
The notation p->grade is the same as (*p).grade
sometimes seeing that helps understand what the arrow operator means
hope that helps
Let's say you have a struct or class called Record.
Record *p; p = new Record; p->grade = 'A';
The notation p->grade is the same as (*p).grade
sometimes seeing that helps understand what the arrow operator means
hope that helps
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote









|