Strings Flashcards
1
Q
How do you declare an array?
A
char string_var[size];
2
Q
Null Character
A
Character ‘\0’ that marks the end of a string in C.
3
Q
For a given size n, how many characters can a string hold? How are the values of the character locations assigned?
A
- n-1, since the last charcter is reserved for a null character.
- Locations are defined from 0 to n-1.
4
Q
How do you define an array of strings?
A
char array_name[array size][string size];
5
Q
How can you initilize an array of strings?
A
char array_name[array size][string size] = {“string characters”, “string characters”};
6
Q
What placeholder do we use so printf and scanf can handle strings?
A
%s