Strings Flashcards

1
Q

Literals written using single quotes

Data Type: char

Can only store one character

A

Characters

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

outputs the ASCII table in Linux

A

man ascii

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

Character functions can be found in the _____ header file

A

ctype.h

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

[Character Function] Checks whether the character is alphabetic

A

isalpha(char c);

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

[Character Function] Checks whether a character is a decimal digit

A

isdigit(char c);

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

[Character Function] Checks if char is alphanumeric

A

isalnum(char c);

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

[Character Function] checks if char is in lowercase

A

islower(char c);

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

[Character Function] Checks if char is in uppercase

A

isupper(char c);

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

[Character Function] Checks if char c is a punctuation

A

ispunct(char c);

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

[Character Function] Checks if char is a white space

A

isspace(char c);

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

[Character Function] Converts char to lowercase

A

tolower(char c);

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

[Character Function] Converts char to uppercase

A

toupper(char c);

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

Literals written using double quotes.

An array of characters.

A

Strings

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

Strings are terminated by the null character ___

A

\0

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

Strings can store up to ____ characters

A

N-1 (bc a slot is reserved for the terminating character \0)

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

Ways to initialize a string

A
  1. Just like an array, specify each character that will be a part of the string as well as don’t forget to include the terminating character \0 at the end.
  2. By using a string literal.
  3. Using a pointer to create a constant string.
17
Q

String functions can be found in the _____ header file.

A

string.h

18
Q

[String Function] Concatenate two strings

A

strcat(char str1, char str2);

19
Q

[String Function] Compares two strings. Returns an int.

A

strcmp(char str1, char str2);

20
Q

[String Function] Copies a string to the other.

A

strcpy(char dest, char src);

21
Q

[String Function] Returns the length of the string.

A

strlen(char str);