Language Question

What does the ? mean in this line of code: "pos = pos == straight ? divergent: straight;". I can not find any reference for a question mark anywhere.

Search for C ternary operator.

pos = pos == straight ? divergent: straight;
if (pos == straight)
  pos = divergent;
  pos = straight;

What does the ? in this code mean: pos = pos == straight ? divergent: straight;

You are looking at the famous ternary operator, invented (I believe) primarily to confuse some people and impress others.

Threads merged.

Personally I find it easier to read with some parentheses, although obviously not required.

pos = (pos == straight) ? divergent: straight;