Question 1
In C, which string function in <string.h> compares two null-terminated strings up to a maximum of 'n' characters?
strncmp(str1, str2, n) compares at most n characters of str1 and str2, returning 0 if they match.
In C, which string function in <string.h> compares two null-terminated strings up to a maximum of 'n' characters?
strncmp(str1, str2, n) compares at most n characters of str1 and str2, returning 0 if they match.
In C, what is the return value of 'strlen("Hello\0World")'?
strlen stops counting at the first null character ('\0'); thus 'Hello' has length 5.
Which C function in <string.h> appends a copy of the source string to the end of the destination string?
strcat(dest, src) concatenates src to the end of dest, overwriting dest's terminating null character.
In C, which function searches for the FIRST occurrence of a character in a string?
strchr(str, ch) returns a pointer to the first occurrence of character ch in string str, or NULL if not found.
Which C library function tokenizes a string into a series of tokens separated by delimiter characters?
strtok(str, delim) parses a string into tokens based on specified delimiter characters.