i = i + i - i * i / i % i; where in this statement do i put the parenthesis?
Wherever you want, whatever operation you want to take "precendence"
z = x > y ? x : y; And can you please tell me in words what this statement is doing?
IF 'Z' is GREATER THAN 'Y' THEN 'Z' = 'X'
ELSE 'Z' = 'Y'
it's just like an if statement. If the condition is satisfied(ie: x IS greater than y, then assign the value of x to z)
and last but not least, how do i rewrite this multi-branching if statement using a switch?
if (i == 1) {
printf("alpha\n");
}
else if (i ==4) {
printf("beta\n");
}
else if (i == 2) {
printf("gamma\n");
}
else{
printf("delta\n");
}
Code:
switch (i) {
case 1:
printf("i is 1");
break;
case 2:
printf("i is 2\n"0);
break;
default:
printf("delta case\n");
break;
}