Strings Flashcards

1
Q

How do you declare an array?

A

char string_var[size];

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Null Character

A

Character ‘\0’ that marks the end of a string in C.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you define an array of strings?

A

char array_name[array size][string size];

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How can you initilize an array of strings?

A

char array_name[array size][string size] = {“string characters”, “string characters”};

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What placeholder do we use so printf and scanf can handle strings?

A

%s

How well did you know this?
1
Not at all
2
3
4
5
Perfectly