question: i want make c program takes string of space separated ints input (positive , negative, variable number of digits) , converts string int array. there question on reading ints string input array on stack overflow doesn't work numbers of digit length more 1 or negative numbers. attempt: #include <stdio.h> int main () { int arr[1000], length = 0, c; while ((c = getchar()) != '\n') { if (c != ' ') { arr[length++] = c - '0'; } } printf("["); ( int = 0; < length-1; i++ ) { printf("%d,", arr[i]); } printf("%d]\n", arr[length-1]); } if enter following terminal: $ echo "21 7" | ./run $ [2,1,7] this array get: [2,1,7] instead of [21,7] if enter following: $ echo "-21 7" | ./run $ [-3,2,1,7] i get: [-3,2,1,7] instead of [-21,7] makes no sense. however, if enter: $ echo "1 2 3 4 5 6 7" | ./run $ [1,2,3,4,5,6,7] note: assuming input ...