Created
July 14, 2017 00:10
-
-
Save kaityo256/8b0d35a9619c7dea6d6a6842dbebd26b to your computer and use it in GitHub Desktop.
A sample using ternary operators
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| int | |
| main(void){ | |
| int a = 1, b = 2; | |
| int c[] = {4,5, (a>b? 1:2)}; | |
| int d[(a>b? 1:2)]; | |
| printf("%d\n",c[2]); // = > 2 | |
| printf("%d\n",sizeof(d)); // => 8 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment