Char a[10]. How many characters can I input in this string | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Char a[10]. How many characters can I input in this string

4th Sep 2019, 3:01 PM
Colin Joy
Colin Joy - avatar
3 Answers
+ 2
That's also a character. You can also put a regular one into the last slot, then you have an array with ten letters, you just can't use it as a string in that case. (Whoever's so quick with the downvote colt here, should try to think a bit harder next time.)
4th Sep 2019, 3:40 PM
HonFu
HonFu - avatar
+ 1
10.
4th Sep 2019, 3:07 PM
HonFu
HonFu - avatar
+ 1
It is a char array in any case. As soon as you put a '\0' in there, be it at the end or someplace else, you can use it as a string, with printf or something. Erase the 0, you can't. Re-insert the 0, you can again. Try it out for yourself!
4th Sep 2019, 3:49 PM
HonFu
HonFu - avatar