How a character array takes input greater than its size?

Open link for code - https://ide.codingblocks.com/s/111361

In here I declared a char array of size 2 but while taking input using cin.getline() I mentioned the size as 5 and so it took 5 inputs including null character.

My question is how char array increased its size, take the input and print it? Also using sizeof() function its showing size as 2 only.

hey @VarIsh, array size it not increased, cin.getline() just reading 5 characters in string and try to store them in array c but as limit it of 2 only, it is giving runtime error.

Okay. Thanks. I didn’t check that runtime error earlier.

hey @VarIsh , if your query is resolved. Please mark this doubt as resolved and rate me on the basis of your experience.
rating option will appear when to mark this doubt as resolved