0

Ok, I thought i knew about post-incrementing and pre-incrementing but...

Funny /Weird /How? /Why?

#include <stdio.h>

int main()
{
   int a = 0;

   printf(" A++ - %d \n A++ - %d \n A++ - %d \n A++ - %d", a++, a++, a++, a++);
}

Without compiling it, what would you say the result is (what values would A++ get)?


And what about this?

#include <stdio.h>

int main()
{
   int a = 0;

   printf(" A++ - %d \n A++ - %d \n A++ - %d \n A++ - %d", a++, a++, a++, ++a);
}

??

Mugurel
  • 1,829
  • 3
  • 17
  • 26

0 Answers0