In today's class we discussed chapter 8, "Strings and Vectors". It is important that when working with strings always leave an extra space in the elements for the null character '\0' which declares where the string ends. Declaring a C-string variable is done using an array of characters.
For example:
char s[11];
Returning to what I said earlier about saving an extra space character, declaring a C-string as char s[11] creates space for only 10 characters since the null character terminator requires the other (1) space.
No comments:
Post a Comment