c++ - Can you help me break down what this code is actually doing? if ((a = b > c ? d : e) == e) a++; -


int = 2, b = 3, c = 5, d = 4, e = 1;  if ((a = b > c ? d : e) == e) a++; 

the answer a=2

i not understand doing.

can me figure out block of code step step?

if ((a = b > c ? d : e) == e) a++; 

equals to:

if (b > c)     = d; else     = e; if (a == e)     a++; 

also have at: what '?' in c++?


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -