char to lower case

I am trying to set a char to lowercase by using the code below. It is coming up with the error C4789: buffer 'sentence' of size 51 bytes will be overrun; 1 bytes will be written stating at offset 52.

The program no longer runs with the code sentence[51] = tolower(sentence[51]);
within it.

1
2
3
4
5
6
7
8
9
10

char sentence[51];

cout << "\n\tPlease enter a sentence: ";
cin.get(sentence,51, '\n');
cin.ignore(10,'\n');

sentence[51] = tolower(sentence[51]);

cout << sentence;
Does not matter, managed to figure it out for myself :)
Topic archived. No new replies allowed.