Rand() function in C

Asked

Viewed 48 times

0

Hello,

I saw this line in a code on the net and I’m having a hard time figuring out what it does exactly.

(Rand() %9 == 4) ? 4 : 2;

I know it gives the value 4 or 2

But what is "%9 == 4", the " and the " doing? 4 : 2" ?

I wonder if anyone can explain?

  • Welcome. What you’re looking for is here: https://answall.com/questions/92101/quando-devo-usar-operator-em-c

  • Rand will return a random number, the percetual will be responsible for the rest of the division and the question together with the two points are part of a ternary operator.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.