Tell about strtok & strstr functions

Answers were Sorted based on User's Feedback



Tell about strtok & strstr functions..

Answer / 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

Tell about strtok & strstr functions..

Answer / shruti

The above answer is perfect...

Kudos..
well done..

Is This Answer Correct ?    3 Yes 1 No

Post New Answer

More C Interview Questions

what is the difference between north western polytechnique university and your applied colleges?? please give ur answers for this. :)

0 Answers  


What are shell structures used for?

0 Answers  


Why is sizeof () an operator and not a function?

0 Answers  


What is difference between far and near pointers?

0 Answers  


What is const volatile variable in c?

0 Answers  






Is c dynamically typed?

0 Answers  


What is the use of parallelize in spark?

0 Answers  


Explain About fork()?

0 Answers   TISL,


what is the differnce between programing langauge and tool? is sas is a programing langauge r tool?

0 Answers   Gamesa, Satyam,


what is different between auto and local static? why should we use local static?

0 Answers  


What is the purpose of clrscr () printf () and getch ()?

0 Answers  


what is the output for the code : main() { int i,j; printf("%d %d ",scanf("%d%d",&i,&j)); }

20 Answers   Infosys,


Categories