You can use the nested statements of the Ternary operator
if(a) { if((a > b) || (a > c)) { printf("\nDo something\n"); } printf("\nstatement X goes here\n"); printf("\nstatement X goes here\n"); }
The code above can be replaced by
(a) ? ( ( a>b || a>c )? printf("\nDo something\n"); : printf("\nstatement X goes here\n");printf("\nstatement Y goes here\n"); ) : exit (0);
The obvious advantage is to reduce the number of lines of code for a given logic, but at the same time reduces the readability of the code.
source share