closed by
611 views
3 votes
3 votes
closed as a duplicate of: Undefined Behaviour in C
#include <stdio.h>
int main()
{
   int i = 8;
   int p = i++*i++;
   printf("%d\n", p);
}
closed by

1 Answer

–2 votes
–2 votes
Answer is 72.
postfix increment is left to right associatively and the precedence of order is postfix increment > multiplication.

Step 1: i = 8

p = 8 * i++;

Step 2 : i++         i=9

p =  8 * 9

Step 3: i++        i=10

p=72

print p

Related questions

0 votes
0 votes
1 answer
1
Anirudh Kaushal asked Apr 4, 2022
261 views
#include<stdio.h int main() { char num = '\011'; printf("%d",num); return 0; }
1 votes
1 votes
2 answers
2
Khushal Kumar asked Jul 7, 2017
604 views
#include <stdio.h int x = 20; int f1() { x = x+10; return x;} int f2() { x = x-5; return x;} int main() { int p = f1() + f2(); printf ("p = %d", p); return 0; }
0 votes
0 votes
1 answer
3
2 votes
2 votes
0 answers
4