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.

Leave a Comment