In this for loop statement
#include<stdio.h>
int main()
{
static int i;
for(++i;++i;++i) {
printf("%d ",i);
if(i==4)
break;
}
return 0;
}
Variable i
is at first 0. The arguments in the for-loop at 1st round are
1st ++i: i = 0 + 1 = 1
2nd ++i: i=1+1=2
So, in first loop I have this for(i=1; i<2; ++i);
or for(i=1; i<=2; ++i);
?
EDIT I found this example online in a test about C. I run this (inside the for-loop , I have a break point so after some loops it breaks) but I was just guessing the behavior of that so I asked it here to be sure. I am learning now C so stupid questions exists for me. Its better to ask, than not.