return tree == NULL ? -1 : tree->height;

I am trying to understand AVL trees but the one really nice example I found has a couple of methods defined like this. It is really pretty but I cannot read it? Can someone explain it to me? Or even just write it out in a more verbose C++

if ( tree == NULL ) {
  return -1;
} else {
  return tree->height;
}

awesome thanks for the speedy replay
just to make sure i understand

return left > right ? left : right;

would be

if (left > right) 
    return left;
else
    return right;

am i understanding this correctly?

>am i understanding this correctly?
So far, yes.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.