What does ?: Mean ????

Hi All

I came across a chunk of code for my TellyMate Shield:

#define CHAR_ESC ‘\x1B’

void cursor_show( bool show )
{ // e or f
Serial.write( CHAR_ESC ) ;
Serial.write( show?‘e’:‘f’ ) ;

It writes an e or an f to show or hide the cursor. My question is regarding the ( show?‘e’:‘f’ ) bit of the code. I can determine from the context that if show is true, Serial.write will send an ‘e’ and if false will send an ‘f’.

Where is this operation explained in the Langauge Reference page? I scoured it and the reference manual and found nothing. Did i miss it?

Putting in ? or : in any search field doesn’t help!

Thanks in advance to anyone who can clear this up for me!


Google "c ternary operator".


a ? b : c

If "a" is true it evaluates to "b", otherwise "c".

Thank You Nick!

Being a Newbie, is there a place in the forum where one can request an addition to the Langauge Reference guide? Or is something like this out of scope?


Maybe post in the "Suggestions for the Arduino Project" section. But honestly, they'll probably point out that it mentions (somewhere) that the language is basically C/C++ and they can't describe every aspect of it.

This is the part that probably needs emphasis, with maybe some direct links to some good C training pages.