Friday, July 31, 2009

What is the function of the strtok command ? ( in c programming)?

What is the function of the strtok command?


a. finds the number of characters that occur from the beginning of the string.


b. adds the second string the first string.


c. separates the first string by the characters in the second string


d. finds the pointer to the first occurrence of a specific character in the string


e. none of the above

What is the function of the strtok command ? ( in c programming)?
It splits a line into "tokens" that have "delimiters" between the "tokens". The "delimiters" are usually white space and punctuation.
Reply:Hi there





I won't give the answer, but here's the explanation:





The strtok() function returns a pointer to the next "token" in str1, where str2 contains the delimiters that determine the token. strtok() returns NULL if no token is found.





See this url for more information and you can choose your answer.





http://www.cppreference.com/stdstring/st...





Hope this helps


No comments:

Post a Comment