I have no idea what i'm doing wrong here, but I'm trying to make a vertical histogram program based on the length of strings input through the commad line using getchar() (one of The C Programming Language excercises), but something seems to be going wrong when I run it. The function printgraph() is supposed to print the histogram using the for loops shown by printing the graph, graph[][] line by line, where j increments the y axis and i increments the x axis. However, when I run this, the graph doesn't print when it reaches this line of code. I've revised the code and gone over it many times, and still haven't a clue. I know that this may also be a trivial question to some, and I apologize that I lack much experience, but all help is appreciated.
#include <stdio.h>
char graph[11][11];
void printgraph(){
int i, j;
char graph[11][11];
for(j = 0; j<=10; j++){
for(i = 0; i<=10; i++){
putchar(graph[i][j]);
}
printf("\n");
}
}
int main(){
char c, graph[11][11];
int i, j, onoroff, numchar[10];
for(i = 10; i>=0; i--)
graph[0][i] = i;
for(j=10;j>=0; j--)
graph[j][0] = j;
for(j=0;j<=9;i++)
numchar[j] = 0;
onoroff = 1;
i = 0;
while(graph[1][10] != 'O' || graph[2][10] != 'O' || graph[3][10] != 'O' || graph[4][10] != 'O' || graph[5][10] != 'O' || graph[6][10] != 'O' || graph[7][10] != 'O' || graph[8][10] != 'O' || graph[9][10] != 'O' ||graph[10][10] != 'O'){
while((c = getchar()) != EOF){
printgraph();
if(c == ' '|| c == '\n' || c == '\t'){
if(onoroff == 1){
numchar[i]++;
graph[i][numchar[i]+1] = 'O';
}
onoroff = 0;
i = 0;
}else if(onoroff == 1){
i++;
}else if(onoroff == 0){
onoroff = 1;
i++;
}
}
}
return 0;
}