I have a confusion in basic concept for C language for loop increment. This is my code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int j=0;int a;
for(j;j<=3;++j)
{
printf("hello\n");
a=j;
}
printf("%d,%d\n",j,a);
}
My question is: Why is the output of a not equal to output of j? I was thinking that if j
is getting increased for every iteration and the value of j
is being stored in a
, then why is a not the same?