✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
What is the output of the following program that compiles correctly? (Hint: When evaluating logical operators, the compiler ignores the remainder of the expression when it is sure of the final answer at any point of evaluation of the sub-expression - something often referred to as "short-circuit evaluation". This is a cryptic hint, I know, but enjoy unravelling it and discovering its meaning and implication!)
#include <stdio.h>
int main(){ int a= -2, b= -1, c = 0, d = 1, e = 2; int r1, r2; r2 = a++ || ++b || c++ || ++d || e; r1 = a && b++ && ++c && d++ && ++e; printf("%d %d %d\n", r1,r2,a+b+c+d+e); return 0;}
Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!