But I just wanted to know why is it essential to use a null character to terminate an array like this? Because a null takes one byte, whereas storing the length of the string with the string itself could take multiple bytes. Memory was scarce back in the day, so the smaller solution won out.
Why are strings null-terminated?
A null-terminated string means that the end of your string is defined through the occurrence of a null-char (all bits are zero). "Other strings" e.g. have to store their own lenght. A null-terminated string is a native string format in C. String literals, for example, are implemented as null-terminated.
What is the use of terminating null character?
The null character indicates the end of the string. Such strings are called null-terminated strings. The null terminator of a multibyte string consists of one byte whose value is 0. The null terminator of a wide-character string consists of one gl_wchar_t character whose value is 0.