View Single Post
Old 06-15-2002, 12:22 PM   #5 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,720
redhead is on a distinguished road
The nice thing about it, is you can use it in something like:
Code:
void* my_function (int is_true)
{
     return (is_true ? 'e' : 10);
}
So if you dont want to do alot of if/else with the returning values, then you can use it as a shortcut..
And the examples you gave are also in that direction, nice and simple..

And the requirement for the sorrounding () in a cout statement is, because '<<' has higher precedence than the '?' operator.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote