I wrote a program to try and print a 2D table containing a graphical representation of user input using a 2D array in C. I compile and run this program, but not matter how much I press Return or Ctrl+D for EOF, getchar does not appear to yeilding to the instructions in the loop as expected. What am I doing wrong here?
int main()
{
/*ignore these comments, they are outdated todo lists*/
/* make vars init here, change for to while */
/* finish printing */
int c;
int i, sec, other;
char ndigit[3][8];
while((c = getchar()) != EOF) {
if (c == '\n' || '\t' || ' ') {
for(i = 0; i < 63; ndigit[1][i] += 1);
;
}
else if (c >= '0' || c <= '9') {
for(sec = 0; sec < 63; ndigit[2][sec] += 1)
;
}
else
for(other = 0; other < 63; ndigit[3][other] += 1)
;
}
for (i = 0; i <= 3; ++i)
for (sec = 0; sec <= 8; sec++)
printf("%s\n", ndigit[i][sec]);
}