I am learning about strings and I am trying to interpret what the +1 is for when the const MAX_LEN is used. I know strings have a null terminating value, does this allow room for it?
Code:
void readLine(istream &, char *, int); //used for TASK 3 only
#define TASK 1
#if TASK==1
const int MAX_LEN = 7; //longest string allowed.
#else
const int MAX_LEN = 25;
#endif
int main(){
char aString[MAX_LEN+1]; // what is +1 used for?
cout << "Enter a string (maximum of " << MAX_LEN << " characters)\n";
for (int i=1; i<=MAX_LEN; i++) cout << i%10; cout << endl;