hi there. I'd wanted to know if this is a programming error or a compiler error?
This code compiled as a win32 console application. When ID_num is allowed to increment, it reaches 53, then the program freezes and closes itself.
When I compile this with 'Quincy 2005' IDE (LCC compiler), it does not crash at all. it works as I expected, and can reach 99 (C_LIM).
#include <stdio.h>
#define COUNT 100
#define C_LIM (COUNT - 1)
int main(void) {
int value_collector[COUNT],
ID_num = 0;
printf("\nEnter integer, and finalize input by entering '-1'\n\n");
printf("%2d Enter an Integer:",(ID_num + 1));
scanf("%d", &value_collector[ID_num]);
while(ID_num < C_LIM && value_collector[ID_num] != -1) {
ID_num++;
printf("%2d Enter an Integer:", (ID_num + 1));
scanf("%d", &value_collector[ID_num]);
}
return 0;
}
I am a beginner and probably overlooking something. thanks.