Skip to main content

2 docs tagged with "character arrays"

View All Tags

Strings

String are stored and can be handled as arrays of chars which is why you often hear character array instead of string. In C the compiler adds at the end of each string literal the null character, '\0' (not to be confused with NULL) so it knows where the string ends. This also means that the length of a string is always one longer then you might think it is. To get the length of a string you can implement your own function or use the built in function strlen provided in string.h.

Strings

Along with the C way of using strings as character arrays there are many other new things in C++.