Question: Write this function in c++.Use of string and is not allowed .You are required to use char* and implement the use of ** in this

Write this function in c++.Use of string and is not allowed .You are required to use char* and implement the use of ** in this question .
Gtest case to pass:
#include "q1.cpp"
#include
//-------------------Q1_8-----------------
TEST(Question1_8, First) {
char t1[]="Hello World";
char res1[] = "Hello";
char res2[] = "World";
char** r= StrTok(t1,' ');
ASSERT_EQ(0, strcmp(r[0],res1) );
ASSERT_EQ(0, strcmp(r[1],res2) );
}
TEST(Question1_8, Second) {
char t1[]="Hello?World?OOP";
char res1[] = "Hello";
char res2[] = "World";
char res3[] = "OOP";
char** r= StrTok(t1,'?');
ASSERT_EQ(0, strcmp(r[0],res1) );
ASSERT_EQ(0, strcmp(r[1],res2) );
ASSERT_EQ(0, strcmp(r[2],res3) );
}
int main(int argc, char **argv) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
 Write this function in c++.Use of string and is not allowed
pointer to pointer must be used

1 char **Str Tok char *sl, const char s2) 2 / A call to Str Tok breaks stringsl into token' 3 (logical pieces such as words in a line of text) separated by character 4 contained in char 32*/ 5 { 6 }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!