Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 5
    Furthermore, if x were a const int in your examples, the ternary version would be the only choice that compiles. Commented Dec 25, 2008 at 21:48
  • Wouldn't it be better to initialize Three? Commented Dec 26, 2008 at 7:41
  • Shmoopty - Very true, because you can only initialize a constant when it's declared. Jonathan - Yes, yes it would. Edited. Maybe I should have done "//Three is a bool" instead. Commented Dec 26, 2008 at 8:18
  • C = (A > B) ? A : B; Commented Nov 18 at 13:00