drleifz
drleifz

Reputation: 179

Bit representation and meaning of format

I am working on a home assignment and I don't understand one thing about it.. Maybe some of you guys can help me with that.

(a < 0) ? 1 : -1

What does this mean?

Upvotes: 1

Views: 39

Answers (1)

jgr208
jgr208

Reputation: 3066

This is basically saying is the variable a less then 0? if it is 1 if it is not then -1 it is like this

if(a<0)
   1
else
  -1

Upvotes: 1

Related Questions