Skip to content

Instantly share code, notes, and snippets.

@kaityo256
Created July 14, 2017 00:10
Show Gist options
  • Save kaityo256/8b0d35a9619c7dea6d6a6842dbebd26b to your computer and use it in GitHub Desktop.
Save kaityo256/8b0d35a9619c7dea6d6a6842dbebd26b to your computer and use it in GitHub Desktop.
A sample using ternary operators
#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