Machine-translated by Google. Questions are authored in English.
Top

Discussion

The C library function _________ breaks string s1 into a series of tokens using the delimiter s2.

  • A.char *strtok(char *s1,const char *s2);
  • B.char *strtok(char *s2,const char *s1);
  • C.char *strstr(char *s1,const char *s2);
  • D.char *strstr(char *s2,const char *s1);

Answer: A

Correct answer: char *strtok(char *s1,const char *s2);

strtok splits s1 into tokens separated by any of the characters in s2. The first call passes the string; every later call passes NULL to continue where it left off. Note that it modifies the string, writing a null over each delimiter, and keeps state between calls, which makes it unsuitable for reentrant or threaded code.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.