Consider this code: “int v = 20; –v; cout << v++;". What value is printed, what value is v left with?

Consider this code: “int v = 20; –v; cout << v++;". What value is printed, what value is v left with?

LANGUAGE: C++

CHALLENGE:

Consider this code: “int v = 20; –v; cout << v++;”. What value is printed, what value is v left with?

SOLUTION:

19 is printed,v ends up with 20

 

CHALLENGE:

Consider this code: “int s = 20; int t = s++ + –s;”. What are the values of s and t?

SOLUTION:

s is 20 and t cannot be determined

Add comment