@smartset
If you create a array of 10 elements, you will have 10 positions, but the first one is 0, so you will have an array from [0] to [9], thats 10 elements.
If you build a "Hello" string(lets say called st) it will be like this:
-
st[0] = 'H';
-
st[1] = 'e';
-
st[2] = 'l';
-
st[3] = 'l';
-
st[4] = 'o';
-
st[5] = '\0';
-
This array could have a minimum of 6 elements..
strlen would return 5, so the '\0' is st[strlen(st)], so i don't think that -1 should be there..
but i can be wrong..
the '/0' char represents the end of the string. '\n' means a change of line (enter button). So that code is reading lines of the file you specified, those end with a '\n', because you are using fgets, so that will return a line of the file, putting that string in a char array, and changing the '\n' to a end of string.