Can I declare two conditionally two variables in C? The compiler gave an error, but I think I should get the opinion:
int main () {double D1 = 0; If ((double D2 = D1) || (double D3 = 10)) COAT & LT; & Lt; "Wow" & lt; & Lt; Endl; Return 0;
You can do this for only one variable
If (double D2 = D1) COAT & lt; & Lt; "Wow" & lt; & Lt; Endl; And if (double D3 = 10) COAT & LT; & Lt; "Wow" & lt; & Lt; Endl; But I will declare them out of terms. If you are scared of scope, then you can always limit it:
{double D2 = D1; Double D3 = 10; If (D2 || D3) COAT & LT; & Lt; "Wow" & lt; & Lt; Endl; } Of course, it evaluates the second initiator, even if D2 evaluates on the right but I think it is not important
Comments
Post a Comment