+ 2
What types of strings?
3 odpowiedzi
+ 4
Strings in C are generally made with an array of characters.
Example: char exampleString[] = "Hello World!";
+ 1
Strings in C are typically stored in arrays with a pointer to the first element in the array used to access the entire array. Normally the array end is marked with a NULL \0 so routines can find the end of the string. This means that the string array must be large enough to contain one more character than the text being placed in the array.
Since arrays are indexed from 0, defining an array of 10 characters by arr[10] actually reserves 11 spaces arr[0] -arr[10].
(Just edited replacing/0 with \0. Typing with my phone is difficult.)
- 2