Aside from the Eclipse Celestial Spirits arc, what other episodes of Fairy Tail season 2 are anime-exclusive?


Question: Able to Access Elements with Index Greater than Array Length
Answer: It is not safe to be doing this. What it is doing is writing over the memory that happens to lie after the buffer. Afterwards, it is then reading it back out to you. 

This is only working because your cin and cout operations don't say: This is a pointer to one char, I will only write one char. Instead it says: enough space is allocated for me to write to. The cin and cout operations keep reading data until they hit the null terminator \0. 

To fix this, you can replace this with:

std::string data;


C++ will let you make big memory mistakes. 

Some 'rules' that will save you most of the time:

1:Don't use char[]. Instead use string.

2:Don't use pointers to pass or return argument. Pass by reference, return by value.

3:Don't use arrays (e.g. int[]). Use vectors. You still have to check your own bounds.

With just those three you'll be writing some-what "safe" code and non-C-like code.