Tell about strtok & strstr functions
Answers were Sorted based on User's Feedback
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 |
What's wrong with "char *p = malloc(10);" ?
c program for searching a student details among 10 student details
What is character set?
In which mode we open the file for read,write and append also in c ? a)W b)w+ c)r+ d)a
What are the keywords in c?
Why use int main instead of void main?
Which of the following about the C comments is incorrect ? a.commentscan go over multiple lines b.comments can start any where in the line c.a line can contain comments with out any language statements d.comments can occur within comments
What language is lisp written in?
What is action and transformation in spark?
What is the difference b/w Structure & Union?
what information does the header files contain?
6 Answers BSNL, Cisco, GDA Technologies,
A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers