0
#include<stdio.h>
void main()
{
   int num=22;
   printf("%d %d %d", num,++num,++num);
}

The output of the above program is 24 24 24. Can someone explain?

  • Are you sure the output gives this? here n=22; but you are printing num? How's that possible? What value you have assigned to num? – Nabid Nov 29 '17 at 04:19
  • It's num only. I edited it – VISHWA PRIYA Nov 29 '17 at 04:22
  • I think its because when printf is evaluated num is already been incremented twice before it is displayed https://www.programiz.com/article/increment-decrement-operator-difference-prefix-postfix – d3l33t Nov 29 '17 at 04:26

0 Answers0