mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 09:41:36 +00:00
Add conditinal expression (?:) to C.
This commit is contained in:
parent
2fab4dc971
commit
0ab144ff97
@ -226,6 +226,10 @@ int main() {
|
||||
0 || 1; // => 1 (Logical or)
|
||||
0 || 0; // => 0
|
||||
|
||||
//Conditional expression ( ?: )
|
||||
int a, b, z;
|
||||
z = (a > b) ? a : b; // z = max(a, b);
|
||||
|
||||
//Increment and decrement operators:
|
||||
int j = 0;
|
||||
char s[];
|
||||
|
Loading…
Reference in New Issue
Block a user