summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLevi Bostian <levi.bostian@gmail.com>2013-09-01 11:51:25 -0500
committerLevi Bostian <levi.bostian@gmail.com>2013-09-01 11:51:25 -0500
commit0ab144ff976c7a701acef552cc8e33b38faa7dbc (patch)
tree2d8879dc57cd5a449ad8569e74317b24c5641037
parent2fab4dc971e3c249dc8be7c365309afb8ab9c209 (diff)
Add conditinal expression (?:) to C.
-rw-r--r--c.html.markdown4
1 files changed, 4 insertions, 0 deletions
diff --git a/c.html.markdown b/c.html.markdown
index e6179ba6..ea047ea0 100644
--- a/c.html.markdown
+++ b/c.html.markdown
@@ -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[];