for example, if we control a for cycle with 6 then we got Segmentation Fault 11 Array length is 6, but its last index is 5. In your case, you probably override part of the Segmentation Fault 11 equals to say 'Index out of range' Index 0, 1, 2, 3, 4 ,5 Value 5, 6 ,1 ,9 ,8 ,7. 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++).