mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-24 10:01:38 +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 || 1; // => 1 (Logical or)
|
||||||
0 || 0; // => 0
|
0 || 0; // => 0
|
||||||
|
|
||||||
|
//Conditional expression ( ?: )
|
||||||
|
int a, b, z;
|
||||||
|
z = (a > b) ? a : b; // z = max(a, b);
|
||||||
|
|
||||||
//Increment and decrement operators:
|
//Increment and decrement operators:
|
||||||
int j = 0;
|
int j = 0;
|
||||||
char s[];
|
char s[];
|
||||||
|
Loading…
Reference in New Issue
Block a user