Tell about strtok & strstr functions
Answer Posted / swetcha
include <string.h>
char *strstr (char * s1 , const char * s2 );
In the above case
The strstr function locates the first occurrence in the
string pointed to by s1 of the sequence of characters
(excluding the terminating null character) in the string
pointed to by s2.
The strstr function returns a pointer to the located
string, or a null pointer if the string is not found. If s2
points to a string with zero length, the function returns
s1.
The strtok function
See the below case
#include <string.h>
char *strtok (char * s1 , const char * s2 );
A sequence of calls to the strtok function breaks the
string pointed to by s1 into a sequence of tokens, each of
which is delimited by a character from the string pointed
to by s2. The first call in the sequence has s1 as its
first argument, and is followed by calls with a null
pointer as their first argument. The separator string
pointed to by s2 may be different from call to call.
The strtok function returns a pointer to the first
character of a token, or a null pointer if there is no token
| Is This Answer Correct ? | 12 Yes | 0 No |
Post New Answer View All Answers
What is data structure in c programming?
What is the process of writing the null pointer?
Once I have used freopen, how can I get the original stdout (or stdin) back?
Does c have circular shift operators?
Linked lists -- can you tell me how to check whether a linked list is circular?
Explain union. What are its advantages?
Is there anything like an ifdef for typedefs?
What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.
any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above
What is 2c dna?
What is the purpose of the statement: strcat (S2, S1)?
What is the significance of c program algorithms?
What is extern variable in c with example?
What is the benefit of using #define to declare a constant?
What does stand for?