What types of strings? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What types of strings?

4th May 2018, 3:30 PM
Manish Thakur
Manish Thakur - avatar
3 Answers
+ 4
Strings in C are generally made with an array of characters. Example: char exampleString[] = "Hello World!";
4th May 2018, 4:14 PM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar
+ 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.)
8th Mar 2019, 2:00 PM
Roger Greenlaw
8th May 2018, 3:56 PM
Uğur Temizel
Uğur Temizel - avatar