The following code fragment produces the correct result


The following code fragment produces the correct result sometimes and sometimes it does not. Explain what is happening and why.

#include
#define max(a,b) ((a) > (b) ? (a): (b))
void main(void)
{
int i = 0;
int j = 0;
int a = 3;
int b = 4;
int c = 6;
int d = 5;
i = max(a,b);
j = max(c,d);
printf("i = %i, j = %in",i,j);
i = max(a++, b++);
printf("a = %i, b = %in",a,b);
j = max(c++,d++);
printf("c = %i, d=%in",c,d);
return;
}

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: The following code fragment produces the correct result
Reference No:- TGS01248235

Now Priced at $20 (50% Discount)

Recommended (93%)

Rated (4.5/5)