this is my code which I expect to see
7, 3, 5, 1, 9
as output but it prints
0, 7, 3, 5, 1
#include <stdio.h>
#define LEN 5
int main(int argc, char const *argv[])
{
int arr[LEN];
int index;
arr[0] = 7;
arr[1] = 3;
arr[2] = 5;
arr[3] = 1;
arr[4] = 9;
int ITM;
for(int IDX = 0; IDX < sizeof(arr) / sizeof(int); ITM = arr[IDX++]){
printf("%d, ", ITM);
}
return 0;
}
what is wrong with this code?
BTW, I know that I can move "ITM = arr[IDX++]" into loop body!