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
Explain how can you be sure that a program follows the ansi c standard?
What is the right type to use for boolean values in c? Is there a standard type?
What functions are used for dynamic memory allocation in c language?
What does sizeof int return?
Tell us bitwise shift operators?
Why is not a pointer null after calling free?
Explain the use of function toupper() with and example code?
Write a Program to accept different goods with the number, price and date of purchase and display them
the statement while(i) puts the entire logic in loop. this loop is called a) indefinite loop b) definite loop c) loop syntax wrong d) none of the above
Write a program of prime number using recursion.
Write a C program on Centralized OLTP, Decentralized OLTP using locking mechanism, Semaphore using locking mechanism, Shared memory, message queues, channel of communication, sockets and a simple program on Saving bank application program using OLTP in IPC?
Explain what are the advantages and disadvantages of a heap?
What is the g value paradox?
Why is c not oop?
Is file a keyword in c?