Hi, i'm writing a sorting program, and I'm stuck in a for loop and I don't know what's wrong with it. The following is my code:
Code:#include <stdio.h> #define NUM_INT 1000 int main (void) { int input[NUM_INT] = {0}; int i; printf("please input arrays of ints to be sorted "); for (i = 0; i <= NUM_INT; i++) { scanf("%d", &input[i]); printf("%d ", input[i]); //TESTING if (input[i] < -2) { printf("program terminated"); return 0; } } printf("Inputed Arrays are: %d", input[i]); return 0; }