0
#include<stdio.h>

void main()
{
  int a[10]={};
  int n=2,i;
  //a[4]=0;
  for(i=0;i<10;i++)
    printf("%d",a[i]);
  printf("\n");
  a[++n] = n++;
  for(i=0;i<10;i++)
    printf("%d",a[i]);
}

As per my understanding this should assign a value of 2 to a[4] but the gcc compiled exe prints 3 to the a[4]. What is wrong with my understanding? Please elaborate.

thanks, muru

muru
  • 111
  • 1
  • 1
  • 10

0 Answers0