S
asked

Expert
Abhay Jajodia answered
Hi s j,
In C, a string needs one extra character at the end called the null terminator '\0' to mark where the text ends.
So char name[20] has 20 slots total:
up to 19 slots for the characters you type
1 slot for
'\0'
That is why you can only store 19 normal characters, even though the array size is 20.
If you have more questions, I am here to help 😊
C
This question was asked as part of the Learn C Programming course.
Our Experts
Sudip BhandariHead of Growth/Marketing
Apekchhya ShresthaSenior Product Manager
Kelish RaiTechnical Content Writer
Abhilekh GautamSystem Engineer
Palistha SinghTechnical Content Writer
Sarthak BaralSenior Content Editor
Saujanya Poudel
Abhay Jajodia
Nisha SharmaTechnical Content Writer
Udayan ShakyaTechnical Content Writer