samedi 23 novembre 2019

Writing conditional statements without using if/else/?

I am looking to write conditional code without using (if/else/?/while etc...) in C language.

For example the following code:

if (Num>6) printf("T");

can be converted to (And still do the same task):

Num>6 && printf("T")

but the following:

bool larger;
if (Num>6) larger=true;

can't be replaced with:

bool larger;
Num>6 && larger=true;

Since lvalue is required as left operand of assignment Any help? (I think && operation and the use of bool would be helpful)

Aucun commentaire:

Enregistrer un commentaire