Q1. Assume X is an array of char such that cahr X[] = “welcome C++II students to pointer camp, come and see the power and comfortable of pointers when it is combined with array. Enjoy camping and find common things between arrays and pointer commands”; Write a function that receives the array X and returns array of pointers to char. Each pointer in this array points to array of char (one word) that contains the phrase “com”. For example the array X has 6 words that each one contains the phrase “com”, they are [welcome, come, comfortable, combined, common and commands], so array of 6 pointers are returned each pointer in the returned array points to a word. Hint: if no words has the phrase “com” a NULL pointer should be returned don't use strstr()... you must write code for this function #in c++
Q1. Assume X is an array of char such that
cahr X[] = “welcome C++II students to pointer camp, come and see the power and comfortable of pointers when it is combined with array. Enjoy camping and find common things between arrays and pointer commands”;
Write a function that receives the array X and returns array of pointers to char. Each pointer in this array points to array of char (one word) that contains the phrase “com”. For example the array X has 6 words that each one contains the phrase “com”, they are [welcome, come, comfortable, combined, common and commands], so array of 6 pointers are returned each pointer in the returned array points to a word.
Hint: if no words has the phrase “com” a NULL pointer should be returned
don't use strstr()... you must write code for this function
#in c++
Step by step
Solved in 4 steps with 1 images