I know,that in char[], in between square brackets we write the lenght of character.
For example, if we write char[10], it should give us 10 characters or less.
But, in my code, where I input my name "Ramunas"(which is 7 characters), instead of giving me 5 characters(Ramun), it still ends up giving "Ramunas". Why does that happen?
#include <iostream>
using namespace std;
int main()
{
char a[5];
cout<<"Hello, enter your name: "<<endl;
cin>>a;
cout<<a<<endl;
return 0;
}