Arrays in C start at 0. In your code you are trying to write/read 1 past the end of your array.