strings in C are null-terminated.
What it means?
It means that they need an extra character to store the null character to indicate the end of the string.
Imagine a function parsing the "ABCDEF", how it knows when the string ended and don't invade other parts of the memory?
A: It knows just because the null character '\0'
So that's the reason you need to declare it with 1 extra character in mind.
To exemplify, imagine the piece of code:
#include <stdio.h>
int main() {
char name[5] = "ABCDE";
char test[] = "ANYTHING";
printf("Hello, %s\n", name);
}
What you think it's gonna print? "ABCDE", right?
Actual output:
Hello, ABCDEANYTHING
It happens because printf tries to find the end of the string (the first null character) but only find it when it's already iterating over the test variable in a improper memory access.
It's a "good scenario", in the worst case your program will crash with a buffer overflow and could leave area for security exploitation.