This program has a problem. What is it?
var a;
var b = (a = 3)? true : false
Answers
Answered by
0
I guess the problem is that variable b holds true/false but it has not been initialised with Boolean data type. Also, I think variable a should either be initialised with some value or it should be default initialised and the data type should be int. An semicolon is missing at the end of the snippet.
The program should be this way:
int a=x; // suppose x is a value given to a
boolean b= (a=3)? true : false;
So, the snippet given has more than one problem.
Similar questions