0

Solve for x (C++)

What is the value of x after the following statements? int x; x = 0; x = x * 30; 1. 0 2. 30 3. 33 4. not defined I have the answer as 4, undefined, but why is that? Is it because if you solve for x mathematically, it is 0x = 30, which can't be?

22nd Aug 2017, 11:19 PM
gorgamin
gorgamin - avatar
1 Odpowiedź
+ 2
only if you are dividing by 0 would complier complains.
22nd Aug 2017, 11:53 PM
Gao Xiangshuai
Gao Xiangshuai - avatar