mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-11 09:14:39 +02:00
Add to ? : example in C.
This commit is contained in:
@@ -199,8 +199,10 @@ int main() {
|
|||||||
0 || 0; // => 0
|
0 || 0; // => 0
|
||||||
|
|
||||||
//Conditional expression ( ? : )
|
//Conditional expression ( ? : )
|
||||||
int a, b, z;
|
int a = 5;
|
||||||
z = (a > b) ? a : b; // "if a > b return a, else return b."
|
int b = 10;
|
||||||
|
int z;
|
||||||
|
z = (a > b) ? a : b; // => 10 "if a > b return a, else return b."
|
||||||
|
|
||||||
//Increment and decrement operators:
|
//Increment and decrement operators:
|
||||||
s[j++]; //returns value of j to s THEN increments value of j.
|
s[j++]; //returns value of j to s THEN increments value of j.
|
||||||
|
Reference in New Issue
Block a user