segmentation fault: 11 in C code
Arrays are indexed from 0, so the loops should be for(i = 0; i<9; i++)
and not for(i = 1; i<10; i++)
In your case, you probably override part of the stack, but in general, going out of boundaries results in undefined behavior.
some_type array[9];
defines array
to be an array of 9 elements, with subscripts going from 0 to 8 inclusive. You can't use array[9]
.