Reputation: 70416
following code is given:
if (c2-c1==0)
if ( c1 != c3 )
{...}
How do I interpret this code? The first if-statement comes without {}. Is the code above equal to the following code?:
if (c2-c1==0){
if ( c1 != c3 )
{...}
}
Upvotes: 4
Views: 3626
Reputation: 8007
Absolutely. Putting no brackets means that the only instruction in the first if is the other if, which can contains anything you want.
Upvotes: 1
Reputation: 2420
Yes. The if statement applies to the next statement after it - which happens to be another if in this case.
Upvotes: 5