Why
char a[5];
cin>>a;
cout<<a;
Input
abcdef
Output
abcdef
why the 6th element is also printing and is there any importance of size in character Array?
Why
char a[5];
cin>>a;
cout<<a;
Input
abcdef
Output
abcdef
why the 6th element is also printing and is there any importance of size in character Array?
@Gurjot if you are storing elements beyond the array size, there is no guarantee whether they’ll get overwritten or not. It might even overwrite some other data without your knowledge, So NEVER store any data beyond the array size.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.